Does Anyone Have A Cron Recipe They Might Share?

Events happening in the community are now at Drupal community events on www.drupal.org.
jebbushell's picture

I am totally bewildered by cron and all the well-intentioned help that is available on the first two pages of Google.

[Edit: Not so much, in the end. See below]

I've tried "Scheduled Tasks" and/or edited my crontab directly, changed the permissions on the test.sh scipt file so that anyone on the planet can have their way with it, all to no avail. All I ever get is "Permission Denied". The contained command is echo "hello world!" which I assume is not the source of the permission error.

The cron implementation appears to be Ubuntu default: no allow or deny files where I looked.

The only thing I can think of is that the script file is under the root directory and I wonder if, even though it is -rwxrwxr-x, and I have tried owner and group of root/root and quickstart/quickstart there might be some other super-rule that is blocking me?

I'm a Windows guy used to working in administrator mode so I do not value security on my development machine in quite the same way as linux people seem to (I did have a problem once, back in '98). I can rebuild it in 30 minutes anyway, because it's virtual, and only has one purpose, and I've had a lot of practise :)

If anyone has a recipe that they can share I would be very grateful and I would suggest that other Windows people might be too. Michael, would this be something that could be added to a Quickstart upgrade if it was thought a good idea?

[Edit]

I used the following components:

  1. A backup script from http://simplebashbu.sourceforge.net/
  2. The following addition to the above inserted prior to any of its logic. It dumps the database into the root directory. The root directory is subsequently tarballed.
    ###   Do MySql backup first  #####
    DB_BACKUP="/home/quickstart/websites/abc.dev/ABC"
    DB_USER="root"
    DB_PASSWD="******"
    echo "* Creating new SQL dump for $DB_BACKUP"
    mysqldump --user=$DB_USER --password=$DB_PASSWD --opt abc_dev | bzip2 > $DB_BACKUP-date +%Y-%m-%d.bz2
    echo "----------------------"
    echo "$DB_BACKUP Done"
  3. Scheduled Tasks. This package is available from the Ubuntu software center.
  4. KSystemLog. Also from the Ubuntu software center.
  5. Nautilus-gksu. Again from the Ubuntu software center.

The last two are not essential but will make life easier for recovering Windows people.

The key point that I missed was that when Scheduled Tasks executes a task, its runtime directory is /home (unless you've done something clever) and life is simpler if your script is in a directory below that. Do not try to use the root directory unless you know what you're doing.

I created a scripts directory under Quickstart and placed my modified simplebashbu.sh script there.
I modified the scripts permissions, ownership and group through Nautilus so that the command:

quickstart@qs10:~$ ls /home/quickstart/scripts -l

reveals the following:

-rwxrw-r-- 1 quickstart quickstart 8772 2012-01-03 14:59 simplebashbu.sh

Yes my root password is hard-coded :P but I am using a disposable environment, and I will fix it when I get something real done instead of all this frikking sysadmin.

I hope this helps someone.

[/Edit]

Quickstart Drupal Development Environment

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: