Koozali.org: home of the SME Server

Delay Autostart of Script

Offline Bud

  • *
  • 487
  • +0/-0
Delay Autostart of Script
« on: March 07, 2014, 05:05:12 AM »
guys please can you help me

I have Two Questions:
1. i need to start a script after a designated time when the sme server reboots. I need to delay the script for say start the script 5mins after the sme server is up and running.
2. when the sme server boots up i want to " HIDE " the text being displayed on what modules etc. are being loaded etc. i just need to display what "errors" there are on system bootup.

how do i get this done?

any help greatly appreciated  :)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Delay Autostart of Script
« Reply #1 on: March 07, 2014, 10:28:55 AM »
before even try to search and help you, could you please tell us what are you trying to achieve?

thank you

Offline Bud

  • *
  • 487
  • +0/-0
Re: Delay Autostart of Script
« Reply #2 on: March 07, 2014, 01:11:52 PM »
Stafano thanks for your reply

I have inherited an sme 8 server at a client on which a special application was loaded for 50+ users.
The problem with the application is that i have to keep "Manually" Starting it in " etc/rc.d/rc7.d " every time the sme server reboots.
To make matters worse the application only seems to " start " when i manually start it after a certain time period of a sme reboot.

any ideas?  :-(


Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Delay Autostart of Script
« Reply #3 on: March 07, 2014, 01:25:38 PM »
Stafano thanks for your reply

I have inherited an sme 8 server at a client on which a special application was loaded for 50+ users.

so far, I can't see any problem :-)

Quote
The problem with the application is that i have to keep "Manually" Starting it in " etc/rc.d/rc7.d " every time the sme server reboots.

why? I mean.. any application having a startup script can be a SME's service..
Code: [Select]
config set myapplicationname service status enabled

in this way SME's knows how to/if  start the service at startup

Code: [Select]
cd /etc/rc.d/init.d
ln -s myinitscript myapplicationname

this should be not necessary: we are creating a symlink of the original startup script with a new name (the point is that myapplicationname must be identical to the service name above)

Code: [Select]
cd /etc/rc7.d
ln -s  /etc/rc.d/init.d/e-smith-service SXXmyapplicationname

we create a symlink to e-smith-service startup script with a name where:
S tells SME to start
XX are numbers.. you can decide when to start the service (you should not start something that need the network before the network itself is up and running)
myapplicationname.. you already know :-)

Quote
To make matters worse the application only seems to " start " when i manually start it after a certain time period of a sme reboot.

any ideas?  :-(

yes.. you should start debuggin it..

alternatively at the approach above mentioned, google can help you

"crontab n minutes after reboot" -> google -> first result

I personally would investigate and keep everything as clean as possible

HTH

P.S. telling us the application name could help us to help you

Offline Bud

  • *
  • 487
  • +0/-0
Re: Delay Autostart of Script
« Reply #4 on: March 10, 2014, 06:10:50 AM »
Stafano thanks for helping

I have used the command " @reboot /bin/sleep 180 ; /etc/rc.d/rc7.d/theapp start "
This does not seem to work as when i look at the cron job logs the application does not start after the designated time

I have also tried the following:
In " /etc/rc.local " I have placed an entry eg: " /root/webjob.sh "
In " /root " webjob.sh has the following

@reboot /bin/sleep 180 ; /etc/rc.d/rc7.d/./theapp start

The problem with this is that after the SME Server does a reboot or cold start, the server waits for the allocated 180 seconds then i can see that the application does start however after the sme server has completed the boot i still need to run the command manually " /etc/rc.d/rc7.d/./theapp start " to get the application to " run "

i need a temporary solution for this. How do I get the script " /etc/rc.d/rc7.d/./theapp start " to start 5 mins after a reboot or cold start?

Any help greatly appreciated  :-)