Which of the shell script runs last on startup?

Using applications, configuring, problems
Post Reply
Message
Author
WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

Which of the shell script runs last on startup?

#1 Post by WIckedWitch »

Just a quickie that someone will probably know off the top of their head;

I want to make the pmcputemp program run and have the temperature visible in the tray when I start up tahrpup-6.0.5. Which of the startup shell scripts do I have to put the command in?
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

User avatar
OscarTalks
Posts: 2196
Joined: Mon 06 Feb 2012, 00:58
Location: London, England

#2 Post by OscarTalks »

Recommended way is to use a .desktop file in /root/.config/autostart
A script or symlink in /root/Startup will still also work as an alternative, but they are trying to phase that mechanism out apparently.

The mods might move this as it does not really belong in the HOWTO (Solutions) section.
Best to post questions in the Beginners or Users section.
Oscar in England
Image

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#3 Post by greengeek »

Make your script and place it in /root/Startup.

Call it "zzzpmccputemp". Pretty sure scripts run in alphabetical order. Thats how i do it anyway.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Yep. In /root/Startup is good.

From experience, I can tell you that some window managers or panels
do NOT pick up what's in /root/.config/autostart. E.g. echinus, pekwm,
bmpanel2.

The new jwm tray picks up stuff in /root/.config/autostart.. But be on
the alert, double-check, if you are using any other WM.

I had to write a special script for bmpanel2's tray:

Code: Select all

#... (excerpt)
     echinus|pekwm|waimea|wmx)if [ "`pgrep bmpanel2`" ];then killall -q bmpanel2
          else
               for i in netmon_wce freememapplet_tray powerapplet_tray firewallstatus retrovol;do
                    killall -q $i
               done
#               kill -s 15 `ps | awk '$4=="yad" && $6 ~ /Boussole/ { print $1}'`

               cd /root/.config/autostart # Other WMs do not seem to pick up the autostart list.
               ls -1 *.desktop > /tmp/autostart.lst
               while read starts;do
                    Exec="`awk -F"=" '$1 ~ /Exec/ { print $2 }' $starts | awk '{ print $1 }'`"
                    [ "`pgrep $Exec`" ] || rox $starts
               done < /tmp/autostart.lst
               sleep 0.4s
#... (excerpt) 
I have to kill netmon_wce, freememapplet_tray, powerapplet_tray,
firewallstatus, retrovol and yad, and restart them to get them to appear
in the bmpanel2 tray.

Greengeek is right, scripts/progs in ~/Startup are run in alphabetical
order.

So the answer to your question is:
the last script to run during startup is the one whose first letter in the
name is closest to "z" in ~/Startup.

IHTH.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

WIckedWitch
Posts: 276
Joined: Thu 29 Mar 2018, 22:13
Location: West Wales bandit country

#5 Post by WIckedWitch »

OscarTalks wrote:Recommended way is to use a .desktop file in /root/.config/autostart
A script or symlink in /root/Startup will still also work as an alternative, but they are trying to phase that mechanism out apparently.

The mods might move this as it does not really belong in the HOWTO (Solutions) section.
Best to post questions in the Beginners or Users section.
Yep - putting a script in /root/Startup worked. Thanks to all for replies :-)

Mods pls feel free to move this thread elsewhere if I've not started it in the appropriate place.
Last edited by WIckedWitch on Sun 13 May 2018, 19:03, edited 3 times in total.
Sometimes I post mindfully, sometimes not mindfully, and sometimes both mindfully and not mindfully. It all depends on whether and when my mind goes walkies while I'm posting :?

User avatar
drunkjedi
Posts: 882
Joined: Mon 25 May 2015, 02:50

#6 Post by drunkjedi »

In Fatdog placing script in /root/Startup works.

There's no /root/.config/autostart folder though.
I don't know creating one will work.

There are also /etc/xdg/autostart and /etc/xdg/Startup folders which also run scripts/.desktop files on startup. (but this maybe only for fatdog, as these are for multiuser system)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

Hi gang.

Tangent, but off-topic*, provided with the hope of thoroughly
confusing your neurones :twisted: , here are a couple of other places
where you can start scripts from:

/etc/rc.d/rc.local
/etc/init.d

* (It's off topic because scripts placed in /etc/init.d or in the rc.local file
will run in the middle of the startup process,
not at the very end. Use
these locations with care, BTW. If you start something too early
in the process, it may not work, or may prevent another script
from running, or cancel it out.)


BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#8 Post by rockedge »

I use both to start during boot apache, mariadb, php 7 zoneminder.

I have to use start scripts in the correct order or for example the starting of zoneminder will fail if the mariadb is not fully started first ... so using
/etc/rc.d/rc.local
/etc/init.d
to spread the start scripts out makes it all work smoothly.

Post Reply