Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
Not sure what you mean by "run for all users"; a command is run by one user, or you could run it repeatedly for each user.
You can run a command at start-up, as the root user, by adding it into /etc/init.d/rc.local.
You can run a command for a particular user by adding it to that user's crontab, and using "@reboot" in the time-to-run fields.
If you want every user to run the command, I would add it to crontab, and maybe modify the adduser script to add a crontab entry in case you add any new users.
Not sure what you mean by "run for all users"; a command is run by one user, or you could run it repeatedly for each user.
You can run a command at start-up, as the root user, by adding it into /etc/init.d/rc.local.
You can run a command for a particular user by adding it to that user's crontab, and using "@reboot" in the time-to-run fields.
If you want every user to run the command, I would add it to crontab, and maybe modify the adduser script to add a crontab entry in case you add any new users.
Hope that helps,
—Robert J Lee
By every user, i mean that the program should run irrespective of who logs in..... i d like to add that this program is a GUI program and can be run only after a user logs in....
I am completely new to linux..... what is a crontab and how do i add anything into it?? Plz help
If you want every user to run the command when they log in, then you can usually just add the command to /etc/X11/Xsession (note the capital letters "X").
This is a shell script, consisting mostly of functions, but you should be able to add your command near the bottom (but above any "exit" lines).
Disadvantages (compared to each user's .xinitrc file) include the fact that this script is important to the correct running of your X session, so if you break anything then you'll break your GUI (so take a backup before you add your commands, just to make sure). But Xsession has the advantage of working for all users, and only needing to edit the change in one place.
Also, users won't be able to opt out of using it (which may be good or bad).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.