{"id":282,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=282"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"launch-net-apps-automatically","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=282","title":{"rendered":"Launch net apps automatically"},"content":{"rendered":"<p>Every time you establish a PPP connection, BeOS looks for a script at <code>\/boot\/home\/config\/etc\/ppp-script<\/code>. 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&#8217;ll probably need to rename <code>ppp-script.sample<\/code> to <code>ppp-script<\/code>. If you want to edit the script, you&#8217;ll need to make it writeable:<\/p>\n<pre>chmod a+w ppp-script<\/pre>\n<p>Because the script is already marked executable, you&#8217;ll need to open it with File | Open in your text editor (or right-click and choose Open With&#8230;). The script can then be customized with the following arguments:<\/p>\n<pre>\n$1 = \"up\" or \"down\"\n$2 = interface name\n$3 = unique cookie for this session (seconds since midnight, Jan 1, 1970)\n$4 = IP address used\n<\/pre>\n<p>Here&#8217;s a sample script that launches NetPositive and Mail-It when the  connection goes up:<\/p>\n<pre>\nif  test ${1} = \"up\"\nthen\n    \/boot\/apps\/net\/BeatWare\/Mail-It\/Mail-It &amp;\n    NetPositive &amp;\nfi\n<\/pre>\n<hr \/>\n<p>Roman Filippov adds the following useful additions to the techniques above:<br \/>\nIt&#8217;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:<\/p>\n<pre>\nif [ \"$1\" = \"up\" ]\nthen\n\t [ $( roster | grep \"NetPositive\" | wc -l) -eq 0 ]  &amp;&amp;  NetPositive &amp;\nfi\n<\/pre>\n<p>You may also want to add a notification sound, such as one of the system sounds  provided by Be or one you&#8217;ve recorded yourself:<\/p>\n<pre>\n #!\/bin\/sh\n if [ \"$1\" = \"up\" ]\n then\n \tMediaPlayer ~\/config\/sounds\/Startup Sounds\/GoodVibesStart.aiff &amp;\n   [ $( roster | grep \"NetPositive\" | wc -l) -eq 0 ]  &amp;&amp;  NetPositive &amp;\n  fi\n  <\/pre>\n<p>You can also switch workspaces first. For instance, if you like Mail-It to<br \/>\n reside in workspace 3 and NetPositive in workspace 4, this can be helpful:<\/p>\n<pre>\nif [ \"$1\" = \"up\" ]\nthen\n\tMediaPlayer ~\/config\/sounds\/Startup Sounds\/GoodVibesStart.aiff &amp;\n \t [ $( roster | grep \"NetPositive\" | wc -l) -eq 0 ]  &amp;&amp;  { Workspaces 3 ;\n NetPositive &amp; }\n\t [ $( roster | grep \"Mail-It\" | wc -l) -eq 0 ]  &amp;&amp;  { Workspaces 2 ;\n \/boot\/apps\/net\/BeatWare\/Mail-It\/Mail-It &amp; }\n fi\n <\/pre>\n<p>There are two more things you might want to do: Determine when you&#8217;ve gone off-line, and add a line to the connection log so you can keep track of online sessions:<\/p>\n<pre>\nif  [ \"$1\" =  \"up\" ]\nthen\n\ttouch \/var\/tmp\/ppp_up\n\tdate \"+%D %T sess $3 started on $2 as $4\" >> \/var\/log\/online.log\n\tMediaPlayer ~\/config\/sounds\/Startup Sounds\/GoodVibesStart.aiff &amp;\n\t [ $( roster | grep \"NetPositive\" | wc -l) -eq 0 ]  &amp;&amp;  { Workspaces 3 ;\n NetPositive &amp; }\n\t [ $( roster | grep \"MailIt\" | wc -l) -eq 0 ]  &amp;&amp;  { Workspaces 2 ;\n \/boot\/apps\/net\/BeatWare\/Mail-It\/Mail-It &amp; }\nfi\nif   [ \"$1\" = \"down\" ]\nthen\n\tif [ -f \/var\/tmp\/ppp_up ]\n\tthen\n\t\trm \/var\/tmp\/ppp_up\n\t\tdate \"+%D %T sess $3 closed\" >> \/var\/log\/online.log\n\t\tMediaPlayer ~\/config\/sounds\/Startup Sounds\/DarkStart.aiff &amp;\n\tfi\nfi\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ll probably need to rename ppp-script.sample to [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[9],"class_list":["post-282","post","type-post","status-publish","format-standard","hentry","tag-networking"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}