GoboLinux DownloadsDocumentationCommunityRecipesPackagesScreenshots

Page | Discussion | Edit | History

Boot script tasks

From GoboLinux Knowledge Base

Jump to: navigation, search

Your boot scripts can make use of "boot tasks", which are little service scripts that can be shipped by programs. A program includes its tasks under Resources/Tasks, and they're linked in /System/Links/Tasks. This is roughly equivalent to the /etc/init.d scripts found in many distributions.

You can launch or stop tasks from the command line, using StartTask and StopTask. For example, the following command will bring a network interface configured in /System/Settings/BootOptions (see section "Network configuration") up:

StartTask Network eth0

Within boot scripts, you don't need to use these launchers, but you have to add a parameter indicating whether the task is being started or stopped:

Exec "Initializing network..." Network Start

[edit] Creating tasks

Strictly speaking, a task is simply a shell script put in the appropriate directory, which accepts "start" and "stop" parameters. In this imaginary example, one could have a file /Programs/Foo/1.0/Resources/Tasks/Foo with these contents:

#!/bin/sh

case "$1" in
[Ss]tart)
# actions to start foo go here
foo --silly-walk
;;
[Ss]top)
# actions to stop foo go here
killall foo
;;
esac # 'esac' is ridiculous, I know... but what can we do, it's shell syntax :)

It's a good idea to use the above example as a template for tasks you create. The "[Ss]" syntax ensures that both "start" and "Start" are recognized, which is nice to avoid typos.


This Documentation page was last reviewed on Never by User:Unknown.

Personal tools