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...:rolleyes:
Thanks!

you could put you script in "/etc/rc2.d" directory
and the script name start with S ,such as S97...

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...

#
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.

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