I try and start a short script nohup the nohup immediately stops.
Here's the code
#!/bin/sh
rm backup.out
for i in `cat /home/xxxxx/Allservers.txt`
do
echo "Logging onto $i"
ssh -qt $i '/usr/local/bin/sudo "/src/bkupsa"'
done >>backup.out
Any ideas?
Yoda
May 22, 2013, 4:14pm
2
First of all don't use this approach: for i in `cat /home/xxxxx/Allservers.txt`
. It is Useless Use of backticks .
Use while
loop instead. Also use -n
option with ssh
to prevent it reading from stdin:
#!/bin/sh
rm backup.out
while read host
do
echo "Logging onto $host"
ssh -qtn $host '/usr/local/bin/sudo "/src/bkupsa"'
done < /home/xxxxx/Allservers.txt > backup.out
When I run the script I receive the following error:
Pseudo-terminal will not be allocated because stdin is not a terminal.
Any more ideas?
Thanks!
---------- Post updated at 03:25 PM ---------- Previous update was at 03:21 PM ----------
When I tun the script nohup, it's great. No errors.
Works like a champ.
Yoda
May 22, 2013, 4:25pm
4
Remove -t
option:
ssh -qn $host '/usr/local/bin/sudo "/src/bkupsa"'