Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question crond works but incrond doesn't

    I'm confused. Totally.

    I have a file that needs to be backed up every time it changes, so I set up an incrond job to rsyc the file to a remote server - SSH keys setup and all that. However, the file is never updated on the remote server after changes are made, even though the incrond event fires.

    incrontab -e
    /opt/sap/conf/sitelists/ IN_CLOSE_WRITE rsync --delete -avze 'ssh -p 2595' /opt/sap/conf/sitelists root(a)<server>:/var/flexshare/shares/sap_businesses/TowncoFuels
    Event fires - /var/log/cron:
    Nov  2 16:13:09 system incrond[23896]: (root) CMD (rsync --delete -avze 'ssh -p 2595' /opt/sap/conf/sitelists root(a)<server>:/var/flexshare/shares/sap_businesses/TowncoFuels)
    But the file on the remote server is not updated with the new content. On a lark, I decided to try the same command in cron.

    crontab -e
    */3 * * * * rsync --delete -avze 'ssh -p 2595' /opt/sap/conf/sitelists root(a)<server>:/var/flexshare/shares/sap_businesses/TowncoFuels
    Crontab fires - /var/log/cron:
    Nov  2 16:15:01 system crond[28036]: (root) CMD (rsync --delete -avze 'ssh -p 2595' /opt/sap/conf/sitelists root(a)<server>:/var/flexshare/shares/sap_businesses/TowncoFuels)
    And VOILA, the remote server shows the new content. I'm baffled.

    P.S. Excuse the (a) replacement for the AT sign. I haven't made my 15 posts yet.

  2. #2
    Well, update here. If I put the rsync job in a shell script and call the script, things work. That's satisfactory enough; just puzzled why the ring-around-the-rosy with only the direct rsync command. Hope this helps someone...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts