Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Languages and Scripting
Showing results for 
Search instead for 
Did you mean: 

Adding cron job from remote server

Go to solution
Trusted Contributor

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.

Dennis Handly
Acclaimed Contributor

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"