Multiple Users - Multiple Scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Multiple Users - Multiple Scripts
# 1  
Old 02-26-2018
HP Multiple Users - Multiple Scripts

Hello All,

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? Smilie If not, what is the best approach to proceed?

Thanks,
# 2  
Old 02-26-2018
Did you consider the cron / crontab reboot trigger entry? Available in some (linux, FreeBSD), mayhap not all, systems. man crontab:
Quote:
Instead of the first five fields, one of eight special strings may appear:

string meaning
------ -------
@reboot Run once, at startup.

Last edited by RudiC; 02-26-2018 at 03:08 PM.. Reason: typo
# 3  
Old 02-28-2018
@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?
# 4  
Old 02-28-2018
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.

Even that may not be possible.

Andrew
# 5  
Old 02-28-2018
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.

Will setuid help in this case?
Thanks,
# 6  
Old 02-28-2018
Quote:
Originally Posted by PikK45
. . . I have to login manually as USERA, USERB, USERC, ... USERn . . .
Why, then, you
Quote:
Originally Posted by PikK45
. . . do not have access to crontab for all the users. . . .
?
# 7  
Old 03-01-2018
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.


What more can you tell us? It's all a bit vague.




Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep from multiple patterns multiple file multiple output

Hi, I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command. Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns. Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies

2. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

3. Shell Programming and Scripting

Create multiple users with individual passwords to users

hi, i am new to shell scripts i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Discussion started by: DONFOX
1 Replies

4. UNIX for Dummies Questions & Answers

Users in multiple groups?

Happy Thanksgiving Everyone!! I have a question about adding users to multiple groups. Thanks in advance Using Red Hat and here are the issues: Example: Users: Bob Mark Groups: SystemsAnalysts BusinessAnalysts If I am adding a user Bob to both groups (SystemsAnalysts and... (2 Replies)
Discussion started by: hansokl
2 Replies

5. Red Hat

Multiple Users

I need to have more than one user logged into my PC's VMWare Linux virtual simultaneously, each seeing a graphical display, to test my software's ability to affect their displays one by one. I have never done anything like this before. My Linux virtuals have been for my development only, that is... (3 Replies)
Discussion started by: BrandonShw
3 Replies

6. Shell Programming and Scripting

id -a multiple users at one time?

Hi Expert, How do I want to id -a multiple users at one time? * i know that this does not work, Thanks (4 Replies)
Discussion started by: regmaster
4 Replies

7. Solaris

How to add multiple users

HI, 1.I want to add multiple users at a same time. How to achive this , since useradd will add only one user at a time,. 2.Also let me know how to install a software in a group of machines where the machines are not configured as zones (1 Reply)
Discussion started by: rogerben
1 Replies

8. UNIX for Dummies Questions & Answers

editing sqlplus id@passwd in multiple scripts, users and directories

hi all, i was given by my supervisor a task to search for scripts which contain oracle sqlplus i.e "myusername/mypasswd @myDB" in every /home/userfolder, which are, all the scripts made by different user. I've done some find command to search string for sqlplus, but it may up too long to respond.... (8 Replies)
Discussion started by: Helmi
8 Replies
Login or Register to Ask a Question