Launch net apps automatically
Every time you establish a PPP connection, BeOS looks for a script at /boot/home/config/etc/ppp-script
. If found, its contents are examined, and any commands it contains are run automatically. Thus, you can easily have your mail client and web browser launched automatically every time you go online (for example). You’ll probably need to rename ppp-script.sample
to ppp-script
. If you want to edit the script, you’ll need to make it writeable:
chmod a+w ppp-script
Because the script is already marked executable, you’ll need to open it with File | Open in your text editor (or right-click and choose Open With…). The script can then be customized with the following arguments:
$1 = "up" or "down" $2 = interface name $3 = unique cookie for this session (seconds since midnight, Jan 1, 1970) $4 = IP address used
Here’s a sample script that launches NetPositive and Mail-It when the connection goes up:
if test ${1} = "up" then /boot/apps/net/BeatWare/Mail-It/Mail-It & NetPositive & fi
Roman Filippov adds the following useful additions to the techniques above:
It’s a good idea to check whether the application is already running before starting it since extra workspace switching can be annoying. An easy trick below does the job:
if [ "$1" = "up" ] then [ $( roster | grep "NetPositive" | wc -l) -eq 0 ] && NetPositive & fi
You may also want to add a notification sound, such as one of the system sounds provided by Be or one you’ve recorded yourself:
#!/bin/sh if [ "$1" = "up" ] then MediaPlayer ~/config/sounds/Startup Sounds/GoodVibesStart.aiff & [ $( roster | grep "NetPositive" | wc -l) -eq 0 ] && NetPositive & fi
You can also switch workspaces first. For instance, if you like Mail-It to
reside in workspace 3 and NetPositive in workspace 4, this can be helpful:
if [ "$1" = "up" ] then MediaPlayer ~/config/sounds/Startup Sounds/GoodVibesStart.aiff & [ $( roster | grep "NetPositive" | wc -l) -eq 0 ] && { Workspaces 3 ; NetPositive & } [ $( roster | grep "Mail-It" | wc -l) -eq 0 ] && { Workspaces 2 ; /boot/apps/net/BeatWare/Mail-It/Mail-It & } fi
There are two more things you might want to do: Determine when you’ve gone off-line, and add a line to the connection log so you can keep track of online sessions:
if [ "$1" = "up" ] then touch /var/tmp/ppp_up date "+%D %T sess $3 started on $2 as $4" >> /var/log/online.log MediaPlayer ~/config/sounds/Startup Sounds/GoodVibesStart.aiff & [ $( roster | grep "NetPositive" | wc -l) -eq 0 ] && { Workspaces 3 ; NetPositive & } [ $( roster | grep "MailIt" | wc -l) -eq 0 ] && { Workspaces 2 ; /boot/apps/net/BeatWare/Mail-It/Mail-It & } fi if [ "$1" = "down" ] then if [ -f /var/tmp/ppp_up ] then rm /var/tmp/ppp_up date "+%D %T sess $3 closed" >> /var/log/online.log MediaPlayer ~/config/sounds/Startup Sounds/DarkStart.aiff & fi fi