start script from - execute init 6 (not as root)


 
Thread Tools Search this Thread
Operating Systems SCO start script from - execute init 6 (not as root)
# 1  
Old 08-06-2004
start script from - execute init 6 (not as root)

I have 2 questions :

----------------------------------
1 - How can I execute a program when Unix Sco reboot?

For example I have two script (two sockets) that I have to
start from 2 different users (root and toto).
I heard something about "etc/init.d" directory, but I don't know what to do next.
I put a script shell in which is starting a script but it doesn't work at all :

cd /mypath/myscript

I check rights on it, and even put "chmod 777" on it (in case...I will change it later)

----------------------------------
2 - How can I execute a command "init 6" from a C Unix script with "system" when this script hadn't been execute by root?
----------------------------------

Sorry for my approximative english and my light Unix knowledge...Smilie
Thanks!
# 2  
Old 08-11-2004
you could put you script in "/etc/rc2.d" directory
and the script name start with S ,such as S97...
# 3  
Old 08-19-2004
Thanks for your answer!
I find a way to execute my script at startup.

There's a file called "userdef" in etc/rc.d/8
I add a line :

su - username -c "cd directory1/directory2;./myscript"

And it works.

--------------------------------

For the second question I don't have any idea...
The only one I've got, is to create another program execute by root...
# 4  
Old 12-17-2004
Re: start script from - execute init 6 (not as root)

Quote:
Originally posted by soshell
[----------------------------------
2 - How can I execute a command "init 6" from a C Unix script with "system" when this script hadn't been execute by root?
----------------------------------

Sorry for my approximative english and my light Unix knowledge...Smilie
Thanks! [/B]
#
first I am also not an expert in SCO, have some years experince with sun en Hp unix as system admin.
#
Thanks for the tip about upstart, I normally use cron but i wanted something else this time and this should work
#
1)
You can use "sudo" if installed, you will have to allow users in the sudoers file. If you only want local users to execute this C script.
2)
You could enter a "su " change in you C script, if it is a complied C program, if it's a C-shell script i wouldn't do it like this.
3)
You could make your own shutdown script and then call this in your script.

Last edited by martikan; 12-17-2004 at 05:43 AM..
# 5  
Old 02-08-2007
hi all

this is post of soshell

Thanks for your answer!
I find a way to execute my script at startup.

There's a file called "userdef" in etc/rc.d/8
I add a line :

su - username -c "cd directory1/directory2;./myscript"

And it works.



how can it works.

i am using fedora4

There's no file called "userdef" in etc/rc.d/8

atlease /8 also not there.

can you plese tell me how can i do this.

your replay will veryusefull.

thank you in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Ubuntu

Start Ubuntu without init

Is it possible to start Ubuntu (or any other modern UNIX OS) or get it to any usable state without the init software. By this I mean replacing init with bash and manually initializing all the components. So far i've managed to edit grub at start and get the bash shell but I don't know where... (3 Replies)
Discussion started by: Kadikis
3 Replies

2. Shell Programming and Scripting

Start up init d script

Hi All, I'm trying to build a start up script, wud be gr8 if any one can explain what the below field means and how can i check it for my script. DAEMON_PATH="/home/wes/Development/projects/myapp" DAEMON=myapp DAEMONOPTS="-my opts" NAME=myapp DESC="My daemon description"... (4 Replies)
Discussion started by: Karthick N
4 Replies

3. Red Hat

root crontab wont execute a script

Greetings/ I have a script listed in my roots crontab 07 9 * * * /opt/HLRSDATA_2010_OCT/HLRS_Scheduler_sp.sh > /opt/HLRSDATA_2010_OCT/logs/HLRTKJob.log This script contains the following #!/bin/bash echo HLRSData Scheduler cd /opt/HLRSDATA_2010_OCT /usr/bin/java -Xms32m -Xmx1024m -cp... (6 Replies)
Discussion started by: RedSpyder
6 Replies

4. Red Hat

init-script failing because of /etc/rc.d/init.d/functions

I encountered a problem on one of our database servers. OS: CentOS 5.5 final Kernel: 2.6.18-238.5.1.el5.028stab085.2 (OpenVZ kernel) We wrote some DB-Start/Stop-scripts ("/db2/admin/scripts_dba/start_services.ksh" and ".../stop_services.ksh") to start the database instances. (Database... (1 Reply)
Discussion started by: bakunin
1 Replies

5. Red Hat

INIT: cannot execute "/etc/X11/prefdm"

Hi I tried the following but no joy! Inserted the linux installation cd.. ( rescue mode)... tried chroot /mnt/sysimage but I get chroot: cannot execute /bin/sh Checked the permission on /bin and it was set to ?r--rw-rx tried to do chmod –R 755 but got error operation not permitted ...... (3 Replies)
Discussion started by: halacil
3 Replies

6. Solaris

Why user has permissions to execute 'init 0'?

Hi all. On one workstation run Solaris 10 a simple user can to execute 'init 0' command without input (su and root password). Example: % init 0 % OK I don't understand how user can execute 'init 0' command on this workstation? 1) I checked /usr/local/etc/sudoers all lines are... (6 Replies)
Discussion started by: wolfgang
6 Replies

7. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

8. Shell Programming and Scripting

login into root from user and execute command through script

i have logged in as user. I want to write a script to login into root and execute commands for eg. ifconfig or other command. kindly help me out. (6 Replies)
Discussion started by: pradeepreddy
6 Replies

9. Solaris

Error in Solaris installation over WAN(unix: Could not start init) Program terminated

I am trying to install Solaris 10 on a target machine which is t1000. ( sun4v). I have configured my jumpstart server to install solaris over WAN. when i boot my machine, the wanboot image gets downloaded properly, miniroot gets downloaded properly, but after that the process fails with the... (3 Replies)
Discussion started by: hemalsid
3 Replies
Login or Register to Ask a Question