Jump to content


Photo

Executing user script on startup - like "rc.local"


  • Please log in to reply
14 replies to this topic

#1 pmmisiek

  • Member
  • 2 posts

0
Neutral

Posted 2 August 2012 - 21:20

Hi All,

How can I execute my scirpt on startup? For example, in red hat linux, fedora or similar systems, there is rc.local file when I can add my own scirpts.

Where can I add scripts to this execute after system startup?

BR

Re: Executing user script on startup - like "rc.local" #2 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 2 August 2012 - 21:26

we use a sys V compatible init, so you can add any script you want.
The default runlevel is 3.

(put the script in /etc/init.d/yourscript, and create a symlink /etc/rc3.d/S01yourscript to /etc/init.d/yourscript)
Or ask google for more details.

Re: Executing user script on startup - like "rc.local" #3 pmmisiek

  • Member
  • 2 posts

0
Neutral

Posted 3 August 2012 - 19:37

Thank You. It's working :)

Re: Executing user script on startup - like "rc.local" #4 tykasan

  • Member
  • 23 posts

+1
Neutral

Posted 25 March 2014 - 23:31

HI, I have a little problem with script startup on boot.

I need to start one simple script and your directions are not working well on my VU+ Solo2.

Would you please help?

 

 

I placed script in /etc/init.d

chmod 777 script_name.sh

 

then in /etc/rc3.d

ln -s /etc/init.d/script_name.sh /etc/rc3.d/S01script_name.sh

 

 

after restart VU nothing happens...

 

when I check if my script is ok I can run it without any problem from console with command... (and it does what it supose to do) :)

/etc/init.d/script_name.sh

 

 

Any ideas? probably something simple I missed... :)

Marcin

 

 

 

 

 

 


VU+Solo2

OpenPLi 7.0


Re: Executing user script on startup - like "rc.local" #5 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 26 March 2014 - 09:50

ln -s /etc/init.d/script_name.sh /etc/rc3.d/S01script_name.sh

should be

ln -s ../init.d/script_name.sh /etc/rc3.d/S01script_name.sh
Real musicians never die - they just decompose

Re: Executing user script on startup - like "rc.local" #6 MiLo

  • PLi® Core member
  • 14,045 posts

+298
Excellent

Posted 26 March 2014 - 09:53

Probably you're missing environment settings. For example HOME is not set, and PATH usually only contains "/bin:/usr/bin".

Direct your script's output to a file (e.g. in /tmp/) so you can read what went wrong. You can do this by running a second script that just runs the actual script with output redirection.
Real musicians never die - they just decompose

Re: Executing user script on startup - like "rc.local" #7 tykasan

  • Member
  • 23 posts

+1
Neutral

Posted 26 March 2014 - 11:26

Thanks MiLo for posting your remarks,

I'll try them as soon as i get chance...

 

can you give ma another advice please?

How to check if HOME/PATH is set correctly?

Regards

Marcin


VU+Solo2

OpenPLi 7.0


Re: Executing user script on startup - like "rc.local" #8 tykasan

  • Member
  • 23 posts

+1
Neutral

Posted 26 March 2014 - 12:07

OK, I know how to set up environment variables...

but question is what settings are correct ones? 
How Home and Path should look like?


VU+Solo2

OpenPLi 7.0


Re: Executing user script on startup - like "rc.local" #9 mattiL

  • Senior Member
  • 268 posts

+5
Neutral

Posted 26 March 2014 - 17:24

Check with command 'set' in a telnet session.

 

Mine looks like this:

 

HOME='/home/root'

PATH='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin'



Re: Executing user script on startup - like "rc.local" #10 tykasan

  • Member
  • 23 posts

+1
Neutral

Posted 26 March 2014 - 21:22

Hi mattiL,

This is what i did. I have the same variables as yours.

I tried to create symlink the way suggested by MiLo and it worked...

 

ln -s ../init.d/script_name.sh /etc/rc3.d/S01script_name.sh 

 

but still dont understand whats the difference...

 

Thank MiLo and MattiL :)

 

All is working fine now.

Marcin


VU+Solo2

OpenPLi 7.0


Re: Executing user script on startup - like "rc.local" #11 tykasan

  • Member
  • 23 posts

+1
Neutral

Posted 30 September 2014 - 22:37

HI All,

 

It sudenly stopped working...

Anybody can help me please?

 

I removed symlink from rc3.d , and I made a new one...

checked for HOME & PATH - all is ok.

 

nothing works......

and again... if i run script in telnet command it works as it should...

 

Please advise.

M


VU+Solo2

OpenPLi 7.0


Re: Executing user script on startup - like "rc.local" #12 Mys3lf

  • Member
  • 21 posts

0
Neutral

Posted 30 May 2018 - 15:04

Is "at" command supported in Openpli?

 

I want to run script 1 minute after start up so I would use "at" command rather than "sleep" cause sleep command just delaying boot.

 

For example

$ at now + 1 minutes
at> echo "Hello world" >

But seems to me that "at" is not supported in OpenPli....



Re: Executing user script on startup - like "rc.local" #13 WanWizard

  • PLi® Core member
  • 68,544 posts

+1,737
Excellent

Posted 30 May 2018 - 15:30

No, it isn't.


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: Executing user script on startup - like "rc.local" #14 Mys3lf

  • Member
  • 21 posts

0
Neutral

Posted 30 May 2018 - 16:22

No, it isn't.

Oh such a pity , can it be installed to enigma2 ?



Re: Executing user script on startup - like "rc.local" #15 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 30 May 2018 - 16:56

Create a script that includes the sleep and the command you want to execute. Then put the script into a init.d script like this:
<path>/script_name &
This don’t delay the boot as the script is executed in background.

Edited by betacentauri, 30 May 2018 - 16:56.

Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04


1 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


    Bing (1)