Calling Crontab over non interactive ssh session
Ok, is there any obvious reason like security permissions why the following script would fail when executed over ssh with a supplied command
File updatecron.sh Code:
#!/bin/bash Code:
ssh user@host updatecron.sh If you have any feedback I would greatly appriciate it and if you have a better idea on how to automate commands like this when pushing to multiple servers I'm all ears. |
name the file 'newcrontab' instead of crontab
anything in /var/log/messages or /var/log/cron ? |
I'll test renaming the script in a few minutes and get back to you.
As for as the log request. For some reason the team in charge of the RH images puts var/log as 600 root root making my ability to look at the logs a very leangthy process. I'll work on that because it isn't something I thought about last night when I ran in to the trouble. |
I would assume that the PATH is different whether you get an interactive or batch session. Can you please check whether it’s in your PATH also when invoked remotely:
Code:
$ ssh user@host which updatecron.sh NB: You can also avoid your own temporary file: Code:
#!/bin/sh Code:
$ ssh user@host /home/user/updatecron.sh '" 30 2 * * * /usr/local/bin/targetprogram 2>&1"' |
You were right. It was a path issue. The file provided need to be explicitly stated. I actually went ahead and used your version for future udpates because it makes it easier. I appriciate the help.
As a second note. I would have never thought about a recursive call to the same script. I like the technique and will need to find more ways to use it in the future. |
Great that it works now.
|
All times are GMT -5. The time now is 04:31 AM. |