Script started in background killed after en og /etc/thinstation.init

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Script started in background killed after en og /etc/thinstation.init

Francis SOUYRI
Hello,

     Because I want to reduce the boot time of our thinstation when
there is a big update, I implemented the possibility to run the update
in background  after the thinstation is up.

I modified the hdupdate package like this:

                         if [ `make_caps ${HDUPDATE_DELAYED}` = "Y" ] ; then
                                 (echo_log "Delayed update needed\n" $debug;
                                 eval ${HDUPDATE_DELAYED_SCRIPT}
                                 FBDISPLAY=0
                                 fwopen
                                 downloadpkg
                                 fwclose
                                 installpkg) &
                         else
                                 FBDISPLAY=1
                                 downloadpkg
                                 installpkg
                         fi

The variable  HDUPDATE_DELAYED_SCRIPT is set to:

HDUPDATE_DELAYED_SCRIPT="case '`ifconfig eth0 | grep HWaddr | awk '{
print $5 }' | cut -c 17`' in 0|1|2|3) sleep 300 ;; 4|5|6|7) sleep 900 ;;
8|9|a|b) sleep 1500 ;; *) sleep 2100 ;; esac"

So if the thinstations are started a the same time they does not update
at the "same" time.

Before the end the the /etc/thinstation.init I have this:

   707 root       0:00 crond
   746 root       0:00 {S09hdupdate} /bin/sh /etc/rc2.d/S09hdupdate init
   749 root       0:00 sleep 900
   768 root       0:00 syslogd -m 0

Just after the end of the script the hdupdate is "killed".

   707 root       0:00 crond
   746 root       0:00 [S09hdupdate]
   768 root       0:00 syslogd -m 0

I try nohup same problem and I do not have this problem with the TS 2.2
and idea ?

Best regards.

Francis

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Thinstation-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/thinstation-developer
Reply | Threaded
Open this post in threaded view
|

Re: Script started in background killed after en og /etc/thinstation.init

Michael K-2
Try adding
trap "" HUP
at the beginning of the script. I similarly tried nohup, which I'm not sure works from init. Also, this came about due to changes in busybox between TS2 and now.

You may need to move the guts out of the init.d script into a seperate shell script with the trap, as init is pretty brutal about killing things it started.

Alternatively, does what you're doing make more sense to do with cron?


On Fri, Mar 7, 2014 at 3:30 AM, Francis SOUYRI <[hidden email]> wrote:
Hello,

     Because I want to reduce the boot time of our thinstation when
there is a big update, I implemented the possibility to run the update
in background  after the thinstation is up.

I modified the hdupdate package like this:

                         if [ `make_caps ${HDUPDATE_DELAYED}` = "Y" ] ; then
                                 (echo_log "Delayed update needed\n" $debug;
                                 eval ${HDUPDATE_DELAYED_SCRIPT}
                                 FBDISPLAY=0
                                 fwopen
                                 downloadpkg
                                 fwclose
                                 installpkg) &
                         else
                                 FBDISPLAY=1
                                 downloadpkg
                                 installpkg
                         fi

The variable  HDUPDATE_DELAYED_SCRIPT is set to:

HDUPDATE_DELAYED_SCRIPT="case '`ifconfig eth0 | grep HWaddr | awk '{
print $5 }' | cut -c 17`' in 0|1|2|3) sleep 300 ;; 4|5|6|7) sleep 900 ;;
8|9|a|b) sleep 1500 ;; *) sleep 2100 ;; esac"

So if the thinstations are started a the same time they does not update
at the "same" time.

Before the end the the /etc/thinstation.init I have this:

   707 root       0:00 crond
   746 root       0:00 {S09hdupdate} /bin/sh /etc/rc2.d/S09hdupdate init
   749 root       0:00 sleep 900
   768 root       0:00 syslogd -m 0

Just after the end of the script the hdupdate is "killed".

   707 root       0:00 crond
   746 root       0:00 [S09hdupdate]
   768 root       0:00 syslogd -m 0

I try nohup same problem and I do not have this problem with the TS 2.2
and idea ?

Best regards.

Francis

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Thinstation-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/thinstation-developer


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Thinstation-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/thinstation-developer
Reply | Threaded
Open this post in threaded view
|

Re: Script started in background killed after en og /etc/thinstation.init

Francis SOUYRI
Hello Michael,

YES ! thank you the "trap" work !

Best regards.

Francis

On 03/07/2014 05:10 PM, Michael K wrote:

> Try adding
> trap "" HUP
> at the beginning of the script. I similarly tried nohup, which I'm not
> sure works from init. Also, this came about due to changes in busybox
> between TS2 and now.
>
> You may need to move the guts out of the init.d script into a seperate
> shell script with the trap, as init is pretty brutal about killing
> things it started.
>
> Alternatively, does what you're doing make more sense to do with cron?
>
>
> On Fri, Mar 7, 2014 at 3:30 AM, Francis SOUYRI <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hello,
>
>           Because I want to reduce the boot time of our thinstation when
>     there is a big update, I implemented the possibility to run the update
>     in background  after the thinstation is up.
>
>     I modified the hdupdate package like this:
>
>                               if [ `make_caps ${HDUPDATE_DELAYED}` = "Y"
>     ] ; then
>                                       (echo_log "Delayed update
>     needed\n" $debug;
>                                       eval ${HDUPDATE_DELAYED_SCRIPT}
>                                       FBDISPLAY=0
>                                       fwopen
>                                       downloadpkg
>                                       fwclose
>                                       installpkg) &
>                               else
>                                       FBDISPLAY=1
>                                       downloadpkg
>                                       installpkg
>                               fi
>
>     The variable  HDUPDATE_DELAYED_SCRIPT is set to:
>
>     HDUPDATE_DELAYED_SCRIPT="case '`ifconfig eth0 | grep HWaddr | awk '{
>     print $5 }' | cut -c 17`' in 0|1|2|3) sleep 300 ;; 4|5|6|7) sleep 900 ;;
>     8|9|a|b) sleep 1500 ;; *) sleep 2100 ;; esac"
>
>     So if the thinstations are started a the same time they does not update
>     at the "same" time.
>
>     Before the end the the /etc/thinstation.init I have this:
>
>         707 root       0:00 crond
>         746 root       0:00 {S09hdupdate} /bin/sh /etc/rc2.d/S09hdupdate
>     init
>         749 root       0:00 sleep 900
>         768 root       0:00 syslogd -m 0
>
>     Just after the end of the script the hdupdate is "killed".
>
>         707 root       0:00 crond
>         746 root       0:00 [S09hdupdate]
>         768 root       0:00 syslogd -m 0
>
>     I try nohup same problem and I do not have this problem with the TS 2.2
>     and idea ?
>
>     Best regards.
>
>     Francis
>
>     ------------------------------------------------------------------------------
>     Subversion Kills Productivity. Get off Subversion & Make the Move to
>     Perforce.
>     With Perforce, you get hassle-free workflows. Merge that actually works.
>     Faster operations. Version large binaries.  Built-in WAN
>     optimization and the
>     freedom to use Git, Perforce or both. Make the move to Perforce.
>     http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
>     _______________________________________________
>     Thinstation-developer mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/thinstation-developer
>
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Thinstation-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/thinstation-developer