Problems with rc.local, it wont run my bash-script at startup
I have some problems with rc.local. It wont execute a scipt of mine at startup.
The script itself works and if I run rc.local manually it works too...
The script to run:
# Getting your external IP-adress from http://whatismyip.org/
set `lynx -dump http://whatismyip.org/`
# Specify the following options
# Senders email:
# Senders usernamne:
# Senders password:
# Recievers email:
# SMTP Server:
# Sending the email
sendEmail -f $SendersEmail \
-t $RecieversEmail \
-s $Server \
-xu $Username \
-xp $Password \
-u $Subject \
[root@Rorschach rc.d]# cat rc.local
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
Doesn't seem to be a lynx-issue. I've tried with hard coded text as message too...
The script lies under / and have chmod 777.
Running CentOS 5.5
(if you didn't get it, this script is for sending the external IP-adress to my email att startup. If a thief is stupid enough to start it connected to internet)
what about using the absolute path of your script?
I've tried other locations too.
To expand on HasC's post the . in ./sendIPmail.sh is a shortcut for current working directory. Basically it is not running since the script can not be found. If you use the full path your script should work as expected.
in rc.local for example?
e.g. without the /bin/sh.
Just /sendIPmail.sh since the script is executable. Furthermore the path to lynx and sendmail may not be set until a user actually logs in so use the full path for them too.
Ok I will try it... and its sendEmail, not sendmail =)
How do I get the full path to a program (sendEmail and lynx)?
Thank you guys. It works now!
|All times are GMT -5. The time now is 11:03 PM.|