Where do I edit for a program to start automatically?SOLVED

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#16 Post by RSH »

Hi.

You can put a script for that in /root/Startup.

Since the welcome1stboot is a compiled binary you can check if it is still running by 'pidof'

I'm currently running Firefox, so pidof firefox gives me 32146 as the process ID

I'm not running aqualung, so pidof aqualung give me nothing, which means, an empty string --> "" <-- returns.

You could use a loop to sleep 1 second after checking for pidof welcome1stboot is NOT "" and executing the functions of your script after pidof welcome1stboot is "".

Code: Select all

BNameOfProg="welcome1stboot"
DontRun="true"
while [ "$DontRun" = "true" ];
do
	if [ "`pidof "'$BNameOfProg'"`" != "" ]; then
		echo "'$BNameOfProg' is still running"
		sleep 1
		else
		echo "'$BNameOfProg' has been exited"
		DontRun="false"
	fi
done

Your script functions here
This should help.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#17 Post by oldyeller »

seaside wrote:oldyeller,

Another approach would be to put welcome1stboot into a "wrapper" script like this -

rename /usr/sbin/welcome1stboot /usr/sbin/welcome1stboot-bin

Make script called /usr/sbin/welcome1stboot -

Code: Select all

#!/bin/sh
/usr/sbin/welcome1stboot-bin
#your script  here
exit 
When welcome1stboot is called, the above script will run and when the dialog is closed "your script here" will run.

Cheers,
s
For something so simple it worked just fine.

I did however do some testing before I saw this post. I edited the delayedrun by replacing the welcome1stboot with my own and that worked as well.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#18 Post by oldyeller »

Hi RSH,

I did try your as well, but it would start my script even after restarting x-server which is something I don't want to happen. Maybe it is the code

Code: Select all

#!/bin/sh 
BNameOfProg="welcome1stboot"
DontRun="true"
while [ "$DontRun" = "true" ];
do
   if [ "`pidof "'$BNameOfProg'"`" != "" ]; then
      echo "'$BNameOfProg' is still running"
      sleep 1
      else
      echo "'$BNameOfProg' has been exited"
      DontRun="false"
   fi
done 

/usr/sbin/welcome

exit
This could be the problem.

User avatar
oldyeller
Posts: 889
Joined: Tue 15 Nov 2011, 14:26
Location: Alaska

#19 Post by oldyeller »

Hello Everyone,

I just wanted to say Thanks very much for your help :D :D :D

I got it to work!!!! Thanks again

Cheers

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#20 Post by technosaurus »

FYI, Puppy does this in a non-standard way and not in accordance with:
http://standards.freedesktop.org/autost ... atest.html

Since puppy is single user (root), these should all be in:
/etc/xdg/autostart/

and for a multiuser system they should be in:
$HOME/.config/autostart/

For better portability in future Pups I would recommend using these (maybe submit a woof patch to Barry) and making $HOME/Startup a symlink to $HOME/.config/autostart.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply