I have to restart 100's of scripts for at least 20+ users once the server restarts for any reason. I wanted to come up with a single script to trigger of all scripts/programs under all users with just one script (without root privilege).
Is it possible to do so? If not, what is the best approach to proceed?
@RudiC: I do not have access to crontab for all the users. Is it possible to have a single script to call the other scritps for all users? And the sub-scripts would still be running under the appropriate users?
Unless your SysAdmin gives you access to these other user accounts via sudo or some other means I cannot see how you can do this manually, let alone automatically.
We also don't know whether these "script" are shell-scripts, perl-scripts, SQL-scripts or written in some other language.
And we don't know why they have to survive a reboot, or what they do, or can do, to save their status at the time of a reboot.
Can you get your users to, say, rewrite the scripts to save their status to, say, a JSON file on a given signal? Then write a shell-script to be run on shutdown to signal these scripts and save their JSON files somewhere? A second shell-script could then run as root by the system on start-up to start the users scripts with a "continue with the settings from this JSON file" switch.
Andrew, Thanks for the inputs. I was talking about shell scripts. I have to login manually as USERA, USERB, USERC, ... USERn and run bunch of processes/scripts. For every user, I have a script to check and start up programs if not running.
What I am trying to accomplish here is to avoid the logging in part.! Instead of logging in as n number of users, I just want to login as 1 user (let's say USER) and run 1 script to startup all the scripts that are required for n number of users. Catch is that the script should be executed as the user itself. For example, USERA has usera.sh script to start all the required programs. If I trigger start_all_users.sh from USER, it should trigger usera.sh as USERA.
Can you not write this as a script and call it in as the machine starts? You haven't said what OS version you have, so the options a too varied to go through just yet. Do you have access as root / a super-user account or just to all the individual accounts?
If you don't have super-user access, maybe we could write something and ask someone who does to set it up, but we need more information first.
If you can run as the super-user (however we arrange it) then you can do things like su - USERA /path/to/script without it prompting for a password.