I’m new to Manjaro.
What the best way is for having a script run after system startup? I want to mount a network drive and start a webserver.
I have seen that the desktop offers a configuration menu ‘Session and Startup’ where I can specify applications for autostart, with a trigger for autostarting them.
I have then created a shell script and added it to the autostart section, triggered by restart (although I would have preferred ‘on system start’, but that’s not in the list).
What I see now is: The script seems to get executed during the shutdown phase of a restart, not during the startup phase. It does not get executed when I first shutdown the system and start it again. So my script will never become effective.
I have solved my problem by adding an ‘@reboot’ entry to root’s crontab. This works fine, but I’m not totally happy with it because I have read somewhere that @reboot is deprecated.
So my questions are:
Can I have a script run at system startup by configuring it somewhere in the settings GUI?
There are some downsides on using .xprofile . For example a script in .xprofile is only exectued after a Human user logs in. This is for me not the same as on boot or on start up.
Another is that a script in .xprofile will only be executed if you log in via a GUI or via startx. And of course it works only on X11. It will not work on Wayland.
I have tried the login trigger, and it doesn’t work. I suppose there is a simple explanation. I have added the login trigger to user root, because the things I want to accomplish need privileges. But after boot, the desktop belongs to a plain user. So there is no user login for root.