Adding backup script.sh via Cron

Discussion in 'Installation/Configuration' started by zkvvoob, Mar 15, 2015.

  1. zkvvoob

    zkvvoob Member

    Hello,
    I found a script (Bash?) that backups MySQL databases on a daily basis and I'd like to add a Cron job to run it. The script in question is located in my /home/user folder and its permissions are set to 777.
    In ISPConfig > Sites > Cron I've added it like this:
    Code:
    55    16    *    *    *    /home/user/ispc3backup.sh &> /dev/null
    Still, after the set time, I don't see the result of the script. When I ran it manually in SSH, it performed what was required of it flawlessly.
    The client under which the job is added has no restrictions for Cron in their settings.
    Could you help me find out what's wrong?
    Thank you.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Is the file
    /home/user/ispc3backup.sh

    owned by the web User of the site to wwhere you added the cronjob?
     
  3. zkvvoob

    zkvvoob Member

    It wasn't, my mistake, so I chown-ed it to web3:client1, then changed the time of the cron job in ISPConfig... but no result, it doesn't appear to have been executed.
    Besides the actual backups as results, is there another way I could diagnose whether the cron job has been run?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Check the syslog file of the server.
     
  5. zkvvoob

    zkvvoob Member

    Is this the same as Monitor > Show System-Log? If so, here are the last entries:
    Code:
    Mar 17 18:05:01 server CRON[10661]: (root) CMD (/usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Mar 17 18:05:01 server CRON[10662]: (getmail) CMD (/usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null)
    Mar 17 18:05:01 server pure-ftpd: (?@127.0.0.1) [INFO] New connection from 127.0.0.1
    Mar 17 18:05:01 server pure-ftpd: (?@127.0.0.1) [INFO] Logout.
    Mar 17 18:05:01 server postfix/smtpd[10407]: connect from localhost.localdomain[127.0.0.1]
    Mar 17 18:05:01 server postfix/smtpd[10407]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
    Mar 17 18:05:01 server postfix/smtpd[10407]: disconnect from localhost.localdomain[127.0.0.1]
    Mar 17 18:05:01 server dovecot: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<***B>
    Mar 17 18:05:01 server dovecot: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<***AB>
    Mar 17 18:05:01 server pure-ftpd: (?@127.0.0.1) [INFO] New connection from 127.0.0.1
    Mar 17 18:05:01 server pure-ftpd: (?@127.0.0.1) [INFO] Logout.
    Mar 17 18:05:01 server postfix/smtpd[10407]: connect from localhost.localdomain[127.0.0.1]
    Mar 17 18:05:01 server postfix/smtpd[10407]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
    Mar 17 18:05:01 server postfix/smtpd[10407]: disconnect from localhost.localdomain[127.0.0.1]
    Mar 17 18:05:01 server dovecot: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<Q***AAB>
    Mar 17 18:05:01 server dovecot: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, secured, session=<4***>
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. But you have to check the whole file e.g. with grep command, not just the last few lines.
     
  7. zkvvoob

    zkvvoob Member

    Here's the whole Syslog available on ISPConfig:
    http://pastebin.com/qxJbT16E

    The thing is, the script in question does not appear anywhere - it's /home/user/ispc3backup.sh
     

Share This Page