This question has been asked numerous times but for some reason, none of the solutions proposed worked for me. I just want to run a simple script after the user has logged in.
Here are my attempts:
- I have tried putting the script in
/etc/init.d/and making a symlink in/etc/rc0.d. - I tried scheduling it using the
@rebootin crontab (crontab -e). Annoyingly,@rebootdoes not seem to work in Ubuntu(?). I tried this simple line@reboot echo "hi there"to no avail. - I tried putting it into the root's crontab(
sudo crontab -e) but still nothing happened. Also a simpleechoin this crontab does not work too. - I also tried to use the @reboot syntax suggested here (
@reboot root /home/me/Desktop/script.sh) - Followed this and placed the path of the script in /etc/rc.local
Notes:
- I'm using Ubuntu 14.04
- home is mounted, but I also tried my attempts in a VM where home is not mounted
- I only want to run the script after the user has logged in
- Nothing fancy about the script it just echoes "hello world"
echo– krato Jul 25 '15 at 01:23gnome-terminalormate-terminal) is this; changemate-terminaltognome-terminaland removesudo -H, and obviously change the chain of commands to justecho hello world– kos Jul 25 '15 at 01:46notify-sendinstead will it send a notification? This way terminal output is not needed – krato Jul 25 '15 at 02:02Xto be running already, so you could use the Startup Applications method to run a script containing thenotify-sendcommand, that way you could also add in other commands). – kos Jul 25 '15 at 02:09notify-send? I'm using Unity as my DE – krato Jul 25 '15 at 02:18notify-send 'hello world'should be enough; create a text file named, say,script.sh, say, in~/; then add a shebang to the start of the file (#!/bin/bash) and the command on the next line; mark the script as executable by runningchmod +x ~/script.shand add an entry to Startup Applications to call it; the command would be simply the path to the script, i.e.~/script.sh– kos Jul 25 '15 at 02:30notify-sendcommand at startup? Beside that, the methods you already tried probably worked, although none of those methods are meant to output to a terminal; let's pick the first method (/etc/init.d/); that's usually used to start daemons, and those scripts are usually run way beforeXis actually running; an easy way to check an/etc/init.d/script's output would be, for example, to redirect the output to a file. – kos Jul 25 '15 at 03:25~/.loginfile? – boardrider Jul 26 '15 at 12:36