I am running CentOS 7 with XFCE as my DE. I made a bash script, originally stored in ~/bin (I have since deleted it), which I wanted to have run automatically at startup. I somehow succeeded, but I have tried to remove it from my autostart programs, to no avail.

  • when I run ctrontab -e, I am given an empty file to edit. It is therefore not started through there.

  • when I open Session and Startup -> Application autostart, the only programs are: spice vdagent, tracker application miner, tracker metadata extractor, tracker user guides miner, XFCE polkit, Xfsettingsd, redshift, power manager, network.

  • when I find its PID and look through /proc/PID/, the exe is a link to /usr/bin/xfce4-terminal (note: the script started an xfce4-terminal and ran commands on it, then stayed open after printing its output). I don't know where else I could find useful information about what ran this program. cwd is a link to ~, root is a link to /, the rest are empty files pretty much.

  • the script is no longer in ~/bin, yet is somehow still being run

  • I also, at one point, installed devilspie2 to manage that terminal window, and messed around with it. I have since uninstalled it. I wouldn't expect it to have anything to do with it, but I figured I'd specify this.

where else could it be started from? How would I know?

  • 2
    Did you accidently save it to your session? Session and Startup->Session – Matthew Gauthier Apr 17 '17 at 13:43
  • 1
    Don't mean to be nit-picky, but crontab really isn't the place to do anything related to system startup activities. I get that you told us you checked there (which is good troubleshooting!), but with crontab in the title I wanted to be clear in case other readers come across this post. – 0xSheepdog Apr 17 '17 at 15:42
  • 1
    @0xSheepdog Good to know, but could you add why that is the case? Throughout searching on how to run scripts on reboot, I found a number of people recommending it: askubuntu.com/a/816/596765 – Devilius Apr 17 '17 at 15:56
  • 1
    Wow, TIL... As the first comment on the AskUbuntu question suggests, the \@reboot is not well known. I had no idea it existed! =) So, presuming it is a fully supported feature, that might just be a good way to accomplish the task. Keep in mind that I was unaware of it -- as many others seem to be as well. If you want to do something in an "off the beaten path" manner, this is great. If you want a well known and established method (for ease of use by others), maybe consider init.d scripts or systemd services; both are well documented and known. YMMV. Thanks for teaching me something new! – 0xSheepdog Apr 17 '17 at 16:04
  • 1
    I personally have had @reboot not work for me correctly, it doesn't necessarily run at the end up startup sequence and therefore might not work as expected – FreeSoftwareServers Apr 18 '17 at 22:08

If you are running systemd you can create a service that will start yourt software and then use systemctl enable [your-service] to start it on boot up. If your using openrc(old init) then you can use a similar method just use rc-update add [service] default

  • 1
    This is the preferred method! I used to use rc.local but it's no longer guaranteed to start after all services so might not work as expected. – FreeSoftwareServers Apr 17 '17 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.