cron and scripts?

tex

Verified User
Joined
Jun 20, 2003
Messages
5
Hi,

(1) Can I use cron to execute a bash script?

(2) Are there plans to allow existing cron jobs to be edited? Currently I have to delete then add a new one (instead of just directly editing it).

(3) If I name a file script.sh then the file manager doesn't offer me an 'edit' link to click on.

(4) Please consider adding a default MIME type so that .sh files can't be downloaded / viewed. I see that application/x-sh is the MIME type for .sh already but it doesn't appear to be doing anything.

Thanks
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,048
Hello,

1) Of course, that's what cron does.

2) Thats the type of feature that we'll look into when we've got all the major "todo's " out of the way.

3) You can still edit the file, just call it using
CMD_FILE_MANAGER/path/to/file.sh?action=edit
I've added .sh to the editable files list. Should be out with 1.10

4) That's something that you should bring up with your host.

John
 

tex

Verified User
Joined
Jun 20, 2003
Messages
5
Hi,

(1) I know that cron is normally allowed to run scripts, of course, but I was wondering if there is some limitation (shell type, etc.) I have a trivial script that won't run, hence my question.
#!/bin/bash
cd /domains/MYDOMAIN_HERE/public_html/cgi-bin
echo "this .sh file ran last at: " >> sh_test.txt
date >> sh_test.txt
(2) Thanks, that sounds good :)

(3) Thanks. Can I see the list of editable files? (There might be 1 or 2 more types I'd like to request).

(4) OK, I thought I'd bring it up here first in case you already knew of the issue.

Thanks again! :)
 

loopforever

Verified User
Joined
May 30, 2003
Messages
298
Location
/home/admin
The script you are trying to run...have you set it's permissions to allow it to be executable?

Run chmod +x script.sh and try running it via command line. Once you confirm it runs this way, then go ahead and add the crontab.
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,048
cd /domains/MYDOMAIN_HERE/public_html/cgi-bin
should be:
cd ~/domains/MYDOMAIN_HERE/public_html/cgi-bin

on top of that, the current working directory should already be in the cgi-bin.. but doing a 'cd' won't hurt anything.

John
 

tex

Verified User
Joined
Jun 20, 2003
Messages
5
Thanks guys for the help. I haven't used a host with this type of file structure before and had never seen
/home/USER
and
/domains/...
ever connected in the parts I've seen so far, but from your posts, I now see that domains is a sub-dir to each user's account. That helps a lot. ( /home/USER/domains/... )

I already had 755 permissions, but thanks anyway.

It's still not working, but the server's been having other troubles too, so I'll test again later.

Thanks,
 
Top