LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rc.d (https://www.linuxquestions.org/questions/linux-software-2/rc-d-347342/)

charafantah 07-27-2005 12:36 PM

KDE Autorun
 
i have a small bash script, that i would like to be runned everytime a user start his computer, and everytime before he shuts down


i thought of placing it in rc5.d and rc0.d
i made
Code:

ln -s ../scripname.sh S80script


but for some weird reason, it didnt work, and it worked, when i placed the same under .kde/Autorun under each users directory....

what am i missing here?
also, is there anyother way to run it in shutdown else than rc0.d ? as i might use Autorun in .kde if i can find somehow to run before shutdown



regards,
Achraf El Kashef

traene 07-27-2005 12:49 PM

I think your skirpt needs a start (and a stop) method. something like:

Code:

case $1 in
    start)
        # do start your things.
        ;;
    stop)
        # do whatever to stop your things
        ;;
    *)
        # print some usage.
        ;;
esac

You may have a look at the other scripts.

charafantah 07-28-2005 05:11 AM

thanks,,
that worked fine...


but my script turned out to be a complete failuer.... as its being executed before anyone log in, and my script depend on the command "whoami" a lot...

so i think it will be better if i use with the Autorun folder in ~/.kde/

but i need to run it again at logout or before shutdown.... where can i add such action?

thanks

pfonseca 07-28-2005 05:30 AM

If your script follows System V arquitecture it can be called/stopped in rc* dirs. Check other scripts that may already be there and follow their structure.

However, it seems to me that the correct place to invoque your script might me from /etc/.bashrc or similar (system wide init scripts, wich are executed at login)

charafantah 07-28-2005 06:37 AM

thanks for help...

i found out that if i create a directory called shutdown under ~/.kde/ it will execute anything in this dir.


so am now using
~/.kde/Autostart/ to execute at login
and
~/.kde/shutdown/ to execute when logout
and it's working fine now

thanks alot

pfonseca 07-28-2005 07:05 AM

Yes, assuming that you want to run/cleanup your script actions _only_ when your users use KDE.

I would go for ~/.bashrc , because it is independent of whether you use KDE, GNOME or other desktop manager. (but I cannot help you on the shutdown issue, regarding your whoami dependance)

regards


All times are GMT -5. The time now is 10:00 PM.