How can I make a command run once the next time I log in?
5,052
Solution 1
This is really "ugly" solution, but you can add classic logon/startup script and after first run remove this script automatically.
#!/bin/bash
your command &
rm /path/to/script/yourscript.sh
The script will be removed, so it can't be started again.
(I'm sure there's a bettter solution, but I don't know it.)
Solution 2
running a script has couple of options How to run scripts on start up?
I would try .gnomerc one, you can make it one time by making your script remove itself from .gnomerc once its done.
Related videos on Youtube
Comments
-
RusGraf over 1 year
How can I schedule a command to run the next time I log in? I don't want it to run every time, just once.
-
karthick87 over 13 yearsAdd your command in /etc/rc.local ?
-
Michael Gundlach over 13 yearsSimilar to How to run scripts on start up of ubuntu?
-
-
RusGraf over 13 yearsThis gets the job done. For insurance, I went with
mv "$0" /home/user/.old-scripts/
instead of rm. -
Olathe almost 11 yearsThis question is about running it during the next log in only, not during every start of the system.
-
Scaine almost 11 yearsTrue enough. I saw the 'autostart' tag and took it from there.