Adding cron job from remote server (319 Views)
Trusted Contributor
Posts: 407
Registered: ‎03-27-2007
Message 1 of 2 (319 Views)
Accepted Solution

Adding cron job from remote server



I tried adding a cron job from remote server, but problem came with "*" symbol mentioned in the cron job. i used below command



ssh -q abc "echo "00 08 28 * * /usr/local/scripts/" >> /var/spool/cron/crontabs/root"


but it end up with an entry in crontab, where the whole list of files were there in place of "*".  


Please help me in this.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,853
Registered: ‎03-06-2006
Message 2 of 2 (318 Views)

Re: Adding cron job from remote server with ssh

>ssh -q abc "echo "00 08 28 * * /usr/local/scripts/" >> /var/spool/cron/crontabs/root"


Your problem is in quoting.  You're trying to do nested quotes which the shell interprets differently.  Try:

ssh -q abc "echo '00 08 28 * * /usr/local/scripts/' >> /var/spool/cron/crontabs/root"

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation