Note that there are some explanatory texts on larger screens.

plurals
  1. POCrontab not working
    primarykey
    data
    text
    <p>I use crontab -e to add the following:</p> <pre><code>36 * * * * /root/Backup/backup.sh </code></pre> <p>But it does not work! </p> <p>I find this in syslog, but it actually does not run:</p> <pre><code>Oct 6 15:36:01 ubuntu CRON[7685]: (root) CMD (/root/Backup/backup.sh) </code></pre> <p>I sure my script works as it runs successfully if I run it directly.</p> <pre><code># # define a function to create directory # fnCreateFolder() { if [ ! -d $1 ]; then mkdir $1 echo "New directory, '$1', is created" fi } ############################################################################ # # Full pathname to binaries to avoid problems with aliases and builtins etc. # DATECMD="/bin/date" RMCMD="/bin/rm" subdir=`${DATECMD} +%Y-%m-%d` if [ ! -d "$subdir" ]; then fnCreateFolder "$subdir" fi ############################################################################ subdir=`${DATECMD} +%Y-%m-%d` fnCreateFolder "$subdir" datetime=`${DATECMD} +%Y-%m-%d_%Hh%Mm%Ss_%p` echo "date-time: $datetime" backupname="Backup@$datetime.sql" # backup DB mysqldump -u'sun' -p'sun2010fyp' smartward &gt; $backupname echo "start tar cvzf Backup($datetime).tar.gz $backupname" # zip the backup file tar cvzf "Backup($datetime).tar.gz" "$backupname" echo "finished zip $backupname as Backup($datetime).tar.gz" # move tar file to dest folder echo "&amp; move it to the destination directory" mv "Backup($datetime).tar.gz" "$subdir" # &amp; remove the backup file after zipping it ${RMCMD} -f "$backupname" echo "finally removed $backupname" #DONE </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload