Expect script for pushing out cron
Hi!
I am in need of an expect script to update cron on multiple hosts. Expect is installed on the system and I am hoping if someone has a handy script already, to update cron on multiple hosts from an admin host, please share. Thanks, Allan. |
You shouldn't need an expect script. Just setup public key authentication for ssh.
Then you can just do "cat new-cron-file | ssh <remote> crontab" IF you are dealing with a cluster, use the cluster tools to distribute the update. |
Hi!
I dont have sshkeyless setup on hundreds of hosts. Do need expect script to work for now. Thanks, Allan. |
for j in `cat host-list`
do expect -f /tmp/sshlogin.expect done can't read "j": no such variable while executing "spawn ssh -n username@$j 'crontab -l | tee /tmp/info'" (file "/tmp/sshlogin.expect" line 2) |
I think you will have to export j to make it available in the environment.
Putting a public key on each system is safer than embedding a script with your password. |
All times are GMT -5. The time now is 03:41 PM. |