Cron Path


#1

Hi
I am trying to run a Cron job for the automysqlbackup program. Not sure what I need to put as the path to the file when setting it up through control panel. The file is in the root folder of a site - xxx.com. I tried putting http://www.xxx.com/automysqlbackup.sh, but the email I receive says no such file.

thanks in anticipation

Paul

http://www.hardskills.co.uk
Developing commercial awareness
Strategy, marketing and finance training


#2

That’s not a path, that is a URI (and a uri-path or url-path is the part after the hostname starting with the slash). When asked for a path to a file or program, you need to specify a filesystem path. Given username “username”, and domain “example.com”, here are what you need to use for situations:

/home/username = filesystem path to user “home directory”
/home/username/example.com = filesystem path to “web directory”

It is not a good idea put shell scripts in the web directory though. Try making another directory for shell scripts and other files that you don’t want people to download from the web site:

/home/username/bin = maintenance programs and scripts

If you do have files in the web directory that shouldn’t be downloaded, change the permissions to deny world read access. (ie 750 for directories or 640 for files).

As for setting the cron job, your path might look like /home/username/bin/automysqlbackup.sh - but also don’t forget to set the permissions on that file to include execute access.

:cool: openvein.org -//-


#3

The path propably is /home/yourusername/www.xxx.com/automysqlbackup.sh


#4

Many thanks for such a comprehensive answer - really appreciated.

And it worked! Well - almost - I got the script to run, but it couldn’t create the directory for the backups. I have now created a directory ‘backups’ at the same level as the bin directory that you suggested. I have now edited automysqlbackup to point at home/username/backups/. Hopefully this will work - I don’t know how to make the script run manually, so I have to wait for the on-the-hour scheduling through control panel cron settings.

Once again, many thanks.

http://www.hardskills.co.uk
Developing commercial awareness
Strategy, marketing and finance training


#5

Hi - many thanks for your reply - I am almost there with the advice from Atropos7.

http://www.hardskills.co.uk
Developing commercial awareness
Strategy, marketing and finance training


#6

To run the script manually,

Login to shell

and type ~/bin/automysqlbackup.sh

This will work given you have granted execute permissions. Otherwise you can do something like

bash /home/username/bin/automysqlbackup.sh

(The difference is that with execute permissions, shell reads the beginning of the file to find out the program to run to execute the script)

:cool: openvein.org -//-