Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i just finished porting my software to linux, and thats my first time with linux
i have a checkbox that Used to add/remove registry key under windows for startup. now under linux i dunno how to add/remove my application from startup?
also do i need root privilages to do so? cause my software runs as a normal user not root or admin
You need to be specific on which distribution have you ported the software. Different distributions have different ways of doing but the best way would be using /etc/rc.local file for starting the application at the start up of your operating system.
If you want to start an application as a daemon (let's say apache or cron), you should check rc.local as Chaitanya suggested and/or add a startup script in /etc/rc.d or /etc/init.d.
If you just want to automatically start an application for your own user (let's say a mail client), then you have to configure your desktop manager (KDE, Gnome, XFCE...) Then go to google (it is your friend if you can ask it the good question ) with something like "KDE startup applications" and you should get the answer.
i meant how to do it from software? not manual
like add files to which directory? or whatever that makes my application runs on startup
i cant ask the user to open another application under GNOME for example and add new value with my application name
does that require rootprivilages? cause i tried it and raised cant create file exception
Also remember that /etc/rc.local file is already present. You DO NOT create file by that name. You add entries to the file for the applications that need startup at boot.
is there anyway that doesnt need root privilages?
cause the user should do it with single click, like GNOME startup editor, this one asks for no privilages
is there anyway that doesnt need root privilages?
cause the user should do it with single click, like GNOME startup editor, this one asks for no privilages
No. Ordinarily the files and directories in the boot script system can be changed only by root. If they were not it would offer a privilege escalation opportunity allowing arbitrary code to be run as root because the boot scripts are run by root.
Software can be installed by unprivileged users in their home directories and may be started by them at logon but they cannot have software started at boot.
The scheme is not so different from Windows where only members of the Administrative groups can install a service; the only difference is Window's kamikaze arrangement of having users in the Administrative groups by default.
The application runs in user land, so you should probably be looking at the desktop environment you intend to run your software under.
Nowadays, and assuming that the distro you intend to run this under is not from the stone age, what I would do is to check for ~/.config/autostart/<your_file>.desktop, if it doesn't exist then create it. You can google to find the syntax for valid freedesktop's .desktop files. I put a random one from my home as an example:
Code:
$ cat .config/autostart/gkrellm.desktop
[Desktop Entry]
Comment=Monitoriza el hardware local
Comment[es_ES]=Monitoriza el hardware local
Exec=gkrellm
Hidden=true
Name=Monitor Local
Name[es_ES]=Monitor Local
Type=Application
X-GNOME-Autostart-enabled=true
The session managers and control centers from mainstream desktops usually offer a way to configure (mainly enable and disable) session elements.
The application runs in user land, so you should probably be looking at the desktop environment you intend to run your software under.
Nowadays, and assuming that the distro you intend to run this under is not from the stone age, what I would do is to check for ~/.config/autostart/<your_file>.desktop, if it doesn't exist then create it. You can google to find the syntax for valid freedesktop's .desktop files. I put a random one from my home as an example:
Code:
$ cat .config/autostart/gkrellm.desktop
[Desktop Entry]
Comment=Monitoriza el hardware local
Comment[es_ES]=Monitoriza el hardware local
Exec=gkrellm
Hidden=true
Name=Monitor Local
Name[es_ES]=Monitor Local
Type=Application
X-GNOME-Autostart-enabled=true
The session managers and control centers from mainstream desktops usually offer a way to configure (mainly enable and disable) session elements.
WHOHOOOOOOOOOOO!
man ur the best!
this works for gnome only?
or all desktops use this path (~/.config/autostart) just diffrent scripts?
That depends on how good the DE (desktop environment) "freedesktop-ness" is.
The freedesktop aims to create a set of specifications on how applications should interact with the DE, so you can make sure that things like the window manager hints, the system tray, the autostart folders and many other things will work no matter what DE you are using at a given momment. You can visit freedesktop.org to get you started. The concrete info that applies in this case is this:
So, the answer is that it *should* work on any recent distro with any mainstream DE and some mainstream up-to-date standalone window managers that can do session handling.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.