Reputation: 3156
I am trying to run a script at every system startup. Here is the Script :
#!/bin/sh
echo $(sensible-browser http://localhost/example/user=$USER)
I put copied the script to /etc/init.d/
changed the file permission to 755 and then ran the command sudo update-rc.d scriptname.sh defaults
.
tried to run the script via /etc/rc.local
too but no luck. Nothing Happens when the system boots up.
What else can I do ?
Upvotes: 1
Views: 281
Reputation: 72756
You usually don't want to start a browser at system startup--you want to start it after you log in. For that your shell provides startup files (e.g. $HOME/.profile
for Bourne heritage shells, or $HOME/.login
for csh type shells). As an alternative, X11 programs can be started from $HOME/.xinitrc
or $HOME/.xsession
.
Maybe we can help if we knew what you were actually trying to achieve.
Upvotes: 1
Reputation: 143966
I'm assuming that your default webbrowser requires X to run (e.g. firefox). When the rc.d scripts run, it's not necessarily that your script runs after X is started (or that you have permissions to open a window). If you want to have your browser pop up the page http://localhost/example/user=$USER
, you're going to have to look into KDM or GDM or whatever display manager you have and have it run an external script after startup.
Upvotes: 1