Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: jncs on November 09, 2007, 03:29:25 AM

Title: Startup folder
Post by: jncs on November 09, 2007, 03:29:25 AM
Hi,

I want a script (with 755 permissions) to run at startup.
I've tried to put the script in many folders like /etc/init.d, /etc/rc.d/rc7.d, and others but the script doesn't run!

Witch folder is the startup folder in SME?
Title: Re: Startup folder
Post by: thomasch on November 09, 2007, 06:10:57 AM
Hi,

I want a script (with 755 permissions) to run at startup.
I've tried to put the script in many folders like /etc/init.d, /etc/rc.d/rc7.d, and others but the script doesn't run!

Witch folder is the startup folder in SME?

put a command to call your script in /etc/rc.d/rc.local

This script will be executed *after* all the other init scripts.
You can put your own initialization stuff in here if you don't
want to do the full Sys V style init stuff.
Title: Re: Startup folder
Post by: mmccarn on November 09, 2007, 06:49:53 PM
When I was working on the howto for USBDisks, I was told by one of the developers to put startup scripts into  /etc/e-smith/events/local/ instead of editing rc.local.  Everything I know about it can be found at: http://wiki.contribs.org/USBDisks#Mount_your_disk_automatically_at_boot-up, which I take to say:

* place your local startup script in /etc/e-smith/events/local
* use a filename that will cause your script to run at the appropriate time - 'S95xxxx' should be among the last scripts run at reboot; 'S96xxxx' would run after that, etc.

Title: Re: Startup folder
Post by: jncs on November 12, 2007, 04:31:42 PM
Thanks to all!

I don't understand why (it doesn't work on I posted my first message!) but my script is running on "/etc/rc.d/rc7.d".

However I followed up mmccarn advice! I put the script in "/etc/e-smith/events/local" and it's work fine!
Title: Re: Startup folder
Post by: jncs on November 12, 2007, 05:11:31 PM
However I followed up mmccarn advice! I put the script in "/etc/e-smith/events/local" and it's work fine!

 :???: Sorry! That doesn't worked at all!  :sad:

I browsed the folder "/etc/e-smith/events/local" and I've notice there was Symbolic Link files!
Then I look up for the real files and they are in "/etc/e-smith/events/actions" so I moved the script to that folder and I put a Symbolic Link to my script!
The others scripts have 544 permissions. I put 544 permissions on mine.
Then I restarted my SME Server and the script wasn't running!
What I've missed up?
Should I run some "expand-template"... or "event-signal"?
What should I do?
Title: Re: Startup folder
Post by: cactus on November 12, 2007, 07:25:08 PM
What I've missed up?
Should I run some "expand-template"... or "event-signal"?
What should I do?
The reason probably is in your script.
Does your script run as a certain user?
Did you make your script executable?
Do you have the environment variables like path defined? If not you might need to supply the full path for all executables and files.
Title: Re: Startup folder
Post by: jncs on November 12, 2007, 08:05:49 PM
The reason probably is in your script.
Does your script run as a certain user?
Did you make your script executable?
Do you have the environment variables like path defined? If not you might need to supply the full path for all executables and files.

Q: Does your script run as a certain user?
A: No.

Q: Did you make your script executable?
A: Yes. (544 or even 777)

Q: Do you have the environment variables like path defined? If not you might need to supply the full path for all executables and files.
A: I don't think that is necessary...

My script is from No-IP (DDNS services) and it runs in "/etc/rc.d/rc7.d".

The script is:

#######################################################
#! /bin/sh
# . /etc/rc.d/init.d/functions # uncomment/modify for your killproc
case "$1" in
    start)
        echo "Starting noip2."
        /usr/local/bin/noip2
    ;;
    stop)
        echo -n "Shutting down noip2."
        killproc -TERM /usr/local/bin/noip2
    ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
exit 0
#######################################################
Title: Re: Startup folder
Post by: mmccarn on November 13, 2007, 01:54:56 PM
If you put this script in /etc/e-smith/events/local you're just going to get a "Usage..." message somewhere during boot.

You'd need to have a script in /etc/e-smith/events/local like this:
Code: [Select]
#! /bin/sh
/usr/local/bin/noip2

Or you'd have to put your script somewhere like /etc/rc.d/init.d/noip, then put a script in /etc/e-smith/events/local that looks like this:
Code: [Select]
#! /bin/sh
/etc/rc.d/init.d/noip start
Title: Re: Startup folder
Post by: jncs on November 13, 2007, 02:01:21 PM
Thanks!