From e2a741bebb16b0ce2f83f5d1e30383604436cdb5 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Thu, 29 Oct 2009 11:22:40 -0400 Subject: stap-server initscript cleanup and follow fedora initscript requirements. --- NEWS | 2 +- initscript/README.initscript | 355 ------------------------------------------ initscript/README.stap-server | 355 ++++++++++++++++++++++++++++++++++++++++++ initscript/README.systemtap | 355 ++++++++++++++++++++++++++++++++++++++++++ initscript/config | 20 --- initscript/config.stap-server | 6 + initscript/config.systemtap | 20 +++ initscript/stap-server.in | 212 +++++++++++++------------ systemtap.spec | 56 +++++-- 9 files changed, 894 insertions(+), 487 deletions(-) delete mode 100644 initscript/README.initscript create mode 100644 initscript/README.stap-server create mode 100644 initscript/README.systemtap delete mode 100644 initscript/config create mode 100644 initscript/config.stap-server create mode 100644 initscript/config.systemtap diff --git a/NEWS b/NEWS index 9fe26ba6..d13e81af 100644 --- a/NEWS +++ b/NEWS @@ -380,7 +380,7 @@ - Systemtap initscript is available. This initscript allows you to run systemtap scripts as system services (in flight recorder mode) and control those scripts individually. - See README.initscript for details. + See README.systemtap for details. - The stap "-r DIR" option may be used to identify a hand-made kernel build directory. The tool determines the appropriate release string diff --git a/initscript/README.initscript b/initscript/README.initscript deleted file mode 100644 index c7bb4888..00000000 --- a/initscript/README.initscript +++ /dev/null @@ -1,355 +0,0 @@ -Systemtap initscript -Version 0.2.1 -Author: Masami Hiramatsu - -INDEX -===== -1. Introduction -2. Usage -3. Files -4. Configuration Format -5. How to use - -1. Introduction -=============== -Systemtap initscript aims to provide -- running systemtap script as a service with dependency. -- easy way to control(start/stop) those scripts individually. -The dependency means that which user-defined systemtap script is required by -other script (Here the scripts don't include tapsets). This dependency -will be useful for users who use -DRELAY_HOST and -DRELAY_GUEST. - -2. Usage -======== -2.1 Synopsis - -/sbin/service systemtap {start|stop|restart|status|compile|cleanup} \ - [-r kernelrelease] [-c config] [-R] [-y] [script(s)] - -2.2 Commands - You have to specify one of the below commands. - -2.2.1 start - Run script(s). If the script(s) is already started, the command will be - ignored. If it fails to start, return FAIL. If AUTOCOMPILE option is 'yes' - (see 4.1.9), this will try to compile or update the specified script when - one of the below condition is true. - - compiled cache file does not exist. - - mtime (modified time stamp) of original script file is newer than compiled - script cache. - - script options which is used when compiling(see 4.2.1) has been changed. - - result of `uname -a` has been changed. - If no scripts specified from command line, it starts all scripts in the script - directory or the scripts specified by DEFAULT_START in config (see 4.1.10). - -2.2.2 stop - Stop script(s). If the script(s) is already stopped, this will be ignored. - If it fails to stop, return FAIL. - If no scripts specified from command line, it stops all running scripts. - -2.2.3 restart - Stop and start script(s) again. - -2.2.4 status - Show running script(s) status and dependency. - -2.2.5 compile - Compile script(s) on the specified kernel. This command takes '-r' option - which specifies the release of the kernel(see 2.3.4) on which you would - like to compile script(s). This command asks user whether it can overwrite -existing caches. - -2.2.6 cleanup - Cleanup compiled script(s) from cache directory(see 3.4). This command also - takes '-r' option. If '-r' option is omitted, cleanup all caches for running - kernel. This command asks user whether it can remove caches. - -2.3 Options - Systemtap initscript can have some options. However, since user can't pass - these options on boot, these options are only for testing or managing scripts - after booting. - -2.3.1 -c config_path - You can specify configuration path of this initscript. - -2.3.2 script(s) - You can specify individual scripts to the commands. If you omit to specify - any script, systemtap initscript will execute the command with all scripts - in the script directory(except 'start' and 'stop' command, see 2.2.1 and - 2.2.2). - -2.3.3 -R - If this option is specified, systemtap initscript will try to solve - dependency of specified script(s). This option is always set if you don't - specify any script(s) from command line. - -2.3.4 -r kernelrelease - You can specify release version of the kernel(e.g. 2.6.26.1). This option - is valid only with compile and cleanup commands. - -2.3.5 -y - Answer yes for all questions. - -2.4 Misc -2.4.1 Service Priority - Each initscript has execution priority. Since user would like to trace - other services by using systemtap, systemtap initscript should have the - highest priority. - -3. Files -======== -3.1 initscript - /etc/init.d/systemtap - - This file is an executable bash script. - -3.2 Configurations - Configuration files are written in bash script. - -3.2.1 Global config file - /etc/systemtap/config - - This config file is for global parameters(see 4.1). - -3.2.2 Script config files - /etc/systemtap/conf.d/*.conf - - The config files under this directory are for each scripts or script groups - (see 4.2). - -3.3 Script directory - /etc/systemtap/script.d/ - - Systemtap initscript finds systemtap scripts from this directory. - -3.3.1 Scripts in the directory - /etc/systemtap/script.d/.stp - - Systemtap scripts stored in the script directory must have ".stp" suffix. - -3.4 Cache directory - /var/cache/systemtap// - - Systemtap initscript stores compiled scripts in this directory. - -3.4.1 Compiled scripts (or script caches) - /var/cache/systemtap//.ko - /var/cache/systemtap//.opts - - *.ko file is the compiled script, and *.opts is the file which stores - stap options and uname -a. - -3.5 Message Log - /var/log/systemtap.log - - All messages including compilation errors and detailed messages are sent - to this file. - Some error and warning messages are also sent to console and syslogd (syslog - output is optional, because this service will start before syslog). - -3.7 Status files - /var/run/systemtap/ - - -4. Configuration Format -======================= -Configuration file allows us -- specifying options for each script -- supporting flight recorder mode (on file or memory) - -4.1 Global Parameters - -4.1.1 SCRIPT_PATH - Specify the absolute path of the script directory. - (default: /etc/systemtap/script.d) - -4.1.2 CONFIG_PATH - Specify the absolute path of the script config directory. - (default: /etc/systemtap/conf.d) - -4.1.3 CACHE_PATH - Specify the absolute path of the parent directory of the cache directory. - (default: /var/cache/systemtap) - -4.1.4 TEMP_PATH - Specify the absolute path of the temporary directory on which systemtap - initscript make temporary directories to compile scripts. - (default: /tmp) - -4.1.5 STAT_PATH - Specify the absolute path of the running status directory. - (default: /var/run/systemtap) - -4.1.6 LOG_FILE - Specify the absolute path of the log file - (default: /var/log/systemtap.log) - -4.1.7 PASSALL - If this is set 'yes', systemtap initscript will fail when it fails - to run one of the scripts. If not, systemtap initscript will not - fail(just warn). - (default: yes) - -4.1.8 RECURSIVE - If this is set 'yes', systemtap initscript will always follow script - dependencies. This means, you don't need to specify '-R' option. This flag is - effective only if you specify script(s) from command line. - (default: no) - -4.1.9 AUTOCOMPILE - If this is set 'yes', systemtap initscript automatically tries to compile - specified script if there is no valid cache. Otherwides, it just fails to - run script(s). - (default: yes) - -4.1.10 DEFAULT_START - Specify scripts which will be started by default. If omitted (or empty), - all scripts in the script directory will be started. - (default: "") - -4.1.11 ALLOW_CACHEONLY - If this is set 'yes', systemtap initscript list up cache-only scripts too. - *NOTE*: systemtap initscript will load unexpected obsolate caches with this - option. You should check cache directory before enabling this option. - (default: no) - -4.2 Script Parameters - -4.2.1 _OPT - Specify options passed to stap command for each script. "script-name" is the - name of the script file without the suffix extension(.stp). - Some options are just ignored. And even if you don't specify -F option, - systemtap initscript always add it for flight recorder mode. - - Below options are ignored when compiling script. - -p,-m,-r,-c,-x,-e,-s,-o,-h,-V,-k - - Below options are ignored when starting script. - -h,-V,-v,-t,-p,-I,-e,-R,-r,-m,-k,-g,-P,-D,-b,-u,-q,-w,-l,-d,-L,-F, and - other long options. - -4.2.2 _REQ - Specify script dependency(which script this script requires). - For example, "foo.stp" script requires(or run after) "bar.stp" script, set - - foo_REQ="bar" - - If the script requires many scripts, set all scripts separated by spaces. - - foo_REQ="bar baz" - -4.3 Configuration Example - -4.3.1 Global Config Example ---- -SCRIPT_PATH=/var/systemtap/script.d/ -PASSALL=yes -RECURSIVE=no ---- - -4.3.2 Script Config Example ---- -script1_OPT="-o /var/log/script1.out -DRELAYHOST=group1" -script2_OPT="-DRELAYGUEST=group1" -script2_REQ=script1 ---- - -5. How to use -============= - -5.1 Package Installation - After installing systemtap package, install systemtap-initscript package. - # yum install systemtap-initscript - This package will include initscript and default configuration file and - other files. - -5.2 Script installation -5.2.1 Installing script files - Copy a systemtap script ("script1.stp") into script directory. - # cp script1.stp /etc/systemtap/script.d/ - -5.2.2 Configuration script options - Add configuration file to specify options. - # vi /etc/systemtap/conf.d/group1 - script1_OPT="-o /var/log/group1.log -DRELAYHOST=group1" - -5.2.3 Installing script file with dependency - For example, a script("script2.stp") which shares buffer with another - script("script1.stp"), there is a dependency. In this case, you just do - as following. - - # cp script2.stp /etc/systemtap/script.d/ - # vi /etc/systemtap/conf.d/group1 - script2_OPT="-DRELAYGUEST=group1" - script2_REQ=script1 - - In this case, if stap fails to run script1.stp, systemtap initscript will - not run script2.stp. - -5.3 Testing - After installing all scripts, please make sure to run service successfully. - # service systemtap start - # service systemtap stop - If there is no error, we are ready to use it. - -5.4 Service Enabling - After all test passed, enable systemtap initscript. - # chkconfig systemtap on - -5.5 Adding script -5.5.1 Installing and configuring new scripts - Copy new systemtap script("script3.stp") into script directory. - # cp script3.stp /etc/systemtap/script.d/ - and configure it. - # vi /etc/systemtap/conf.d/group1 - script3_OPT="-DRELAYGUEST=group1" - script3_REQ="script1" - -5.5.2 Start new script - If you've already started systemtap initscript, just start new script. - # service systemtap start script3 - -5.6 Deleting script -5.6.1 Deleting old script - Remove old script ("script2.stp") and remove configure lines - # rm /etc/systemtap/script.d/script2.stp - # vi /etc/systemtap/conf.d/group1 - (delete script2_OPT and script2_REQ) - -5.6.2 Stopping old script and cleanup - Stop old script. - # service systemtap stop script2 - And cleanup the script caches. - # service systemtap cleanup script2 - -5.7 Updating kernel - Usually, you don't need to do anything. Systemtap initscript checks the - kernel version when starting the service, and compile scripts. - (If you would like to use compiled scripts due to lack of compiler or - debuginfo on the system, see 5.8) - However, if you want to avoid compiling when booting system, you can prepare - script caches for new kernel. - # service systemtap compile -r - -5.8 Using with compiled scripts - Sometimes, production systems don't have any compilation environment. Even - though, you can use systemtap initscript with compiled scripts as script - caches, which are compiled on other machine (but same software environment). - -5.8.1 Preparing compiled scripts - As described in 5.2, installing scripts and configure it on the compiling - machine (which has compilation environment). - After that, compile those scripts. - # service systemtap compile -r - And package the compiled scripts and configuration file. - # tar czf stap-scripts-.tar.gz \ - /var/cache/systemtap/ /etc/systemtap/conf.d/ - And copy this package to the target machine. - -5.8.2 Installing pre-compiled scripts - On the target machine, unpackage the compiled scripts into cache - directory. - # tar xzf stap-scripts-.tar.gz -C /var/cache/systemtap/ - # mv /var/cache/systemtap/ /etc/systemtap/conf.d/ - At last, set AUTOCOMPILE=no and ALLOW_CACHEONLY=yes in config file. - # vi /etc/systemtap/config - AUTOCOMPILE=no - ALLOW_CACHEONLY=yes diff --git a/initscript/README.stap-server b/initscript/README.stap-server new file mode 100644 index 00000000..c7bb4888 --- /dev/null +++ b/initscript/README.stap-server @@ -0,0 +1,355 @@ +Systemtap initscript +Version 0.2.1 +Author: Masami Hiramatsu + +INDEX +===== +1. Introduction +2. Usage +3. Files +4. Configuration Format +5. How to use + +1. Introduction +=============== +Systemtap initscript aims to provide +- running systemtap script as a service with dependency. +- easy way to control(start/stop) those scripts individually. +The dependency means that which user-defined systemtap script is required by +other script (Here the scripts don't include tapsets). This dependency +will be useful for users who use -DRELAY_HOST and -DRELAY_GUEST. + +2. Usage +======== +2.1 Synopsis + +/sbin/service systemtap {start|stop|restart|status|compile|cleanup} \ + [-r kernelrelease] [-c config] [-R] [-y] [script(s)] + +2.2 Commands + You have to specify one of the below commands. + +2.2.1 start + Run script(s). If the script(s) is already started, the command will be + ignored. If it fails to start, return FAIL. If AUTOCOMPILE option is 'yes' + (see 4.1.9), this will try to compile or update the specified script when + one of the below condition is true. + - compiled cache file does not exist. + - mtime (modified time stamp) of original script file is newer than compiled + script cache. + - script options which is used when compiling(see 4.2.1) has been changed. + - result of `uname -a` has been changed. + If no scripts specified from command line, it starts all scripts in the script + directory or the scripts specified by DEFAULT_START in config (see 4.1.10). + +2.2.2 stop + Stop script(s). If the script(s) is already stopped, this will be ignored. + If it fails to stop, return FAIL. + If no scripts specified from command line, it stops all running scripts. + +2.2.3 restart + Stop and start script(s) again. + +2.2.4 status + Show running script(s) status and dependency. + +2.2.5 compile + Compile script(s) on the specified kernel. This command takes '-r' option + which specifies the release of the kernel(see 2.3.4) on which you would + like to compile script(s). This command asks user whether it can overwrite +existing caches. + +2.2.6 cleanup + Cleanup compiled script(s) from cache directory(see 3.4). This command also + takes '-r' option. If '-r' option is omitted, cleanup all caches for running + kernel. This command asks user whether it can remove caches. + +2.3 Options + Systemtap initscript can have some options. However, since user can't pass + these options on boot, these options are only for testing or managing scripts + after booting. + +2.3.1 -c config_path + You can specify configuration path of this initscript. + +2.3.2 script(s) + You can specify individual scripts to the commands. If you omit to specify + any script, systemtap initscript will execute the command with all scripts + in the script directory(except 'start' and 'stop' command, see 2.2.1 and + 2.2.2). + +2.3.3 -R + If this option is specified, systemtap initscript will try to solve + dependency of specified script(s). This option is always set if you don't + specify any script(s) from command line. + +2.3.4 -r kernelrelease + You can specify release version of the kernel(e.g. 2.6.26.1). This option + is valid only with compile and cleanup commands. + +2.3.5 -y + Answer yes for all questions. + +2.4 Misc +2.4.1 Service Priority + Each initscript has execution priority. Since user would like to trace + other services by using systemtap, systemtap initscript should have the + highest priority. + +3. Files +======== +3.1 initscript + /etc/init.d/systemtap + + This file is an executable bash script. + +3.2 Configurations + Configuration files are written in bash script. + +3.2.1 Global config file + /etc/systemtap/config + + This config file is for global parameters(see 4.1). + +3.2.2 Script config files + /etc/systemtap/conf.d/*.conf + + The config files under this directory are for each scripts or script groups + (see 4.2). + +3.3 Script directory + /etc/systemtap/script.d/ + + Systemtap initscript finds systemtap scripts from this directory. + +3.3.1 Scripts in the directory + /etc/systemtap/script.d/.stp + + Systemtap scripts stored in the script directory must have ".stp" suffix. + +3.4 Cache directory + /var/cache/systemtap// + + Systemtap initscript stores compiled scripts in this directory. + +3.4.1 Compiled scripts (or script caches) + /var/cache/systemtap//.ko + /var/cache/systemtap//.opts + + *.ko file is the compiled script, and *.opts is the file which stores + stap options and uname -a. + +3.5 Message Log + /var/log/systemtap.log + + All messages including compilation errors and detailed messages are sent + to this file. + Some error and warning messages are also sent to console and syslogd (syslog + output is optional, because this service will start before syslog). + +3.7 Status files + /var/run/systemtap/ + + +4. Configuration Format +======================= +Configuration file allows us +- specifying options for each script +- supporting flight recorder mode (on file or memory) + +4.1 Global Parameters + +4.1.1 SCRIPT_PATH + Specify the absolute path of the script directory. + (default: /etc/systemtap/script.d) + +4.1.2 CONFIG_PATH + Specify the absolute path of the script config directory. + (default: /etc/systemtap/conf.d) + +4.1.3 CACHE_PATH + Specify the absolute path of the parent directory of the cache directory. + (default: /var/cache/systemtap) + +4.1.4 TEMP_PATH + Specify the absolute path of the temporary directory on which systemtap + initscript make temporary directories to compile scripts. + (default: /tmp) + +4.1.5 STAT_PATH + Specify the absolute path of the running status directory. + (default: /var/run/systemtap) + +4.1.6 LOG_FILE + Specify the absolute path of the log file + (default: /var/log/systemtap.log) + +4.1.7 PASSALL + If this is set 'yes', systemtap initscript will fail when it fails + to run one of the scripts. If not, systemtap initscript will not + fail(just warn). + (default: yes) + +4.1.8 RECURSIVE + If this is set 'yes', systemtap initscript will always follow script + dependencies. This means, you don't need to specify '-R' option. This flag is + effective only if you specify script(s) from command line. + (default: no) + +4.1.9 AUTOCOMPILE + If this is set 'yes', systemtap initscript automatically tries to compile + specified script if there is no valid cache. Otherwides, it just fails to + run script(s). + (default: yes) + +4.1.10 DEFAULT_START + Specify scripts which will be started by default. If omitted (or empty), + all scripts in the script directory will be started. + (default: "") + +4.1.11 ALLOW_CACHEONLY + If this is set 'yes', systemtap initscript list up cache-only scripts too. + *NOTE*: systemtap initscript will load unexpected obsolate caches with this + option. You should check cache directory before enabling this option. + (default: no) + +4.2 Script Parameters + +4.2.1 _OPT + Specify options passed to stap command for each script. "script-name" is the + name of the script file without the suffix extension(.stp). + Some options are just ignored. And even if you don't specify -F option, + systemtap initscript always add it for flight recorder mode. + - Below options are ignored when compiling script. + -p,-m,-r,-c,-x,-e,-s,-o,-h,-V,-k + - Below options are ignored when starting script. + -h,-V,-v,-t,-p,-I,-e,-R,-r,-m,-k,-g,-P,-D,-b,-u,-q,-w,-l,-d,-L,-F, and + other long options. + +4.2.2 _REQ + Specify script dependency(which script this script requires). + For example, "foo.stp" script requires(or run after) "bar.stp" script, set + + foo_REQ="bar" + + If the script requires many scripts, set all scripts separated by spaces. + + foo_REQ="bar baz" + +4.3 Configuration Example + +4.3.1 Global Config Example +--- +SCRIPT_PATH=/var/systemtap/script.d/ +PASSALL=yes +RECURSIVE=no +--- + +4.3.2 Script Config Example +--- +script1_OPT="-o /var/log/script1.out -DRELAYHOST=group1" +script2_OPT="-DRELAYGUEST=group1" +script2_REQ=script1 +--- + +5. How to use +============= + +5.1 Package Installation + After installing systemtap package, install systemtap-initscript package. + # yum install systemtap-initscript + This package will include initscript and default configuration file and + other files. + +5.2 Script installation +5.2.1 Installing script files + Copy a systemtap script ("script1.stp") into script directory. + # cp script1.stp /etc/systemtap/script.d/ + +5.2.2 Configuration script options + Add configuration file to specify options. + # vi /etc/systemtap/conf.d/group1 + script1_OPT="-o /var/log/group1.log -DRELAYHOST=group1" + +5.2.3 Installing script file with dependency + For example, a script("script2.stp") which shares buffer with another + script("script1.stp"), there is a dependency. In this case, you just do + as following. + + # cp script2.stp /etc/systemtap/script.d/ + # vi /etc/systemtap/conf.d/group1 + script2_OPT="-DRELAYGUEST=group1" + script2_REQ=script1 + + In this case, if stap fails to run script1.stp, systemtap initscript will + not run script2.stp. + +5.3 Testing + After installing all scripts, please make sure to run service successfully. + # service systemtap start + # service systemtap stop + If there is no error, we are ready to use it. + +5.4 Service Enabling + After all test passed, enable systemtap initscript. + # chkconfig systemtap on + +5.5 Adding script +5.5.1 Installing and configuring new scripts + Copy new systemtap script("script3.stp") into script directory. + # cp script3.stp /etc/systemtap/script.d/ + and configure it. + # vi /etc/systemtap/conf.d/group1 + script3_OPT="-DRELAYGUEST=group1" + script3_REQ="script1" + +5.5.2 Start new script + If you've already started systemtap initscript, just start new script. + # service systemtap start script3 + +5.6 Deleting script +5.6.1 Deleting old script + Remove old script ("script2.stp") and remove configure lines + # rm /etc/systemtap/script.d/script2.stp + # vi /etc/systemtap/conf.d/group1 + (delete script2_OPT and script2_REQ) + +5.6.2 Stopping old script and cleanup + Stop old script. + # service systemtap stop script2 + And cleanup the script caches. + # service systemtap cleanup script2 + +5.7 Updating kernel + Usually, you don't need to do anything. Systemtap initscript checks the + kernel version when starting the service, and compile scripts. + (If you would like to use compiled scripts due to lack of compiler or + debuginfo on the system, see 5.8) + However, if you want to avoid compiling when booting system, you can prepare + script caches for new kernel. + # service systemtap compile -r + +5.8 Using with compiled scripts + Sometimes, production systems don't have any compilation environment. Even + though, you can use systemtap initscript with compiled scripts as script + caches, which are compiled on other machine (but same software environment). + +5.8.1 Preparing compiled scripts + As described in 5.2, installing scripts and configure it on the compiling + machine (which has compilation environment). + After that, compile those scripts. + # service systemtap compile -r + And package the compiled scripts and configuration file. + # tar czf stap-scripts-.tar.gz \ + /var/cache/systemtap/ /etc/systemtap/conf.d/ + And copy this package to the target machine. + +5.8.2 Installing pre-compiled scripts + On the target machine, unpackage the compiled scripts into cache + directory. + # tar xzf stap-scripts-.tar.gz -C /var/cache/systemtap/ + # mv /var/cache/systemtap/ /etc/systemtap/conf.d/ + At last, set AUTOCOMPILE=no and ALLOW_CACHEONLY=yes in config file. + # vi /etc/systemtap/config + AUTOCOMPILE=no + ALLOW_CACHEONLY=yes diff --git a/initscript/README.systemtap b/initscript/README.systemtap new file mode 100644 index 00000000..5c6cac15 --- /dev/null +++ b/initscript/README.systemtap @@ -0,0 +1,355 @@ +Systemtap initscript +Version 0.2.1 +Author: Masami Hiramatsu + +INDEX +===== +1. Introduction +2. Usage +3. Files +4. Configuration Format +5. How to use + +1. Introduction +=============== +Systemtap initscript aims to provide +- running systemtap script as a service with dependency. +- easy way to control(start/stop) those scripts individually. +The dependency means that which user-defined systemtap script is required by +other script (Here the scripts don't include tapsets). This dependency +will be useful for users who use -DRELAY_HOST and -DRELAY_GUEST. + +2. Usage +======== +2.1 Synopsis + +/sbin/service systemtap {start|stop|restart|status|compile|cleanup} \ + [-r kernelrelease] [-c config] [-R] [-y] [script(s)] + +2.2 Commands + You have to specify one of the below commands. + +2.2.1 start + Run script(s). If the script(s) is already started, the command will be + ignored. If it fails to start, return FAIL. If AUTOCOMPILE option is 'yes' + (see 4.1.9), this will try to compile or update the specified script when + one of the below condition is true. + - compiled cache file does not exist. + - mtime (modified time stamp) of original script file is newer than compiled + script cache. + - script options which is used when compiling(see 4.2.1) has been changed. + - result of `uname -a` has been changed. + If no scripts specified from command line, it starts all scripts in the script + directory or the scripts specified by DEFAULT_START in config (see 4.1.10). + +2.2.2 stop + Stop script(s). If the script(s) is already stopped, this will be ignored. + If it fails to stop, return FAIL. + If no scripts specified from command line, it stops all running scripts. + +2.2.3 restart + Stop and start script(s) again. + +2.2.4 status + Show running script(s) status and dependency. + +2.2.5 compile + Compile script(s) on the specified kernel. This command takes '-r' option + which specifies the release of the kernel(see 2.3.4) on which you would + like to compile script(s). This command asks user whether it can overwrite +existing caches. + +2.2.6 cleanup + Cleanup compiled script(s) from cache directory(see 3.4). This command also + takes '-r' option. If '-r' option is omitted, cleanup all caches for running + kernel. This command asks user whether it can remove caches. + +2.3 Options + Systemtap initscript can have some options. However, since user can't pass + these options on boot, these options are only for testing or managing scripts + after booting. + +2.3.1 -c config_path + You can specify configuration path of this initscript. + +2.3.2 script(s) + You can specify individual scripts to the commands. If you omit to specify + any script, systemtap initscript will execute the command with all scripts + in the script directory(except 'start' and 'stop' command, see 2.2.1 and + 2.2.2). + +2.3.3 -R + If this option is specified, systemtap initscript will try to solve + dependency of specified script(s). This option is always set if you don't + specify any script(s) from command line. + +2.3.4 -r kernelrelease + You can specify release version of the kernel(e.g. 2.6.26.1). This option + is valid only with compile and cleanup commands. + +2.3.5 -y + Answer yes for all questions. + +2.4 Misc +2.4.1 Service Priority + Each initscript has execution priority. Since user would like to trace + other services by using systemtap, systemtap initscript should have the + highest priority. + +3. Files +======== +3.1 initscript + /etc/init.d/systemtap + + This file is an executable bash script. + +3.2 Configurations + Configuration files are written in bash script. + +3.2.1 Global config file + /etc/systemtap/config + + This config file is for global parameters(see 4.1). + +3.2.2 Script config files + /etc/systemtap/conf.d/*.conf + + The config files under this directory are for each scripts or script groups + (see 4.2). + +3.3 Script directory + /etc/systemtap/script.d/ + + Systemtap initscript finds systemtap scripts from this directory. + +3.3.1 Scripts in the directory + /etc/systemtap/script.d/.stp + + Systemtap scripts stored in the script directory must have ".stp" suffix. + +3.4 Cache directory + /var/cache/systemtap// + + Systemtap initscript stores compiled scripts in this directory. + +3.4.1 Compiled scripts (or script caches) + /var/cache/systemtap//.ko + /var/cache/systemtap//.opts + + *.ko file is the compiled script, and *.opts is the file which stores + stap options and uname -a. + +3.5 Message Log + /var/log/systemtap.log + + All messages including compilation errors and detailed messages are sent + to this file. + Some error and warning messages are also sent to console and syslogd (syslog + output is optional, because this service will start before syslog). + +3.7 Status files + /var/run/systemtap/ + + +4. Configuration Format +======================= +Configuration file allows us +- specifying options for each script +- supporting flight recorder mode (on file or memory) + +4.1 Global Parameters + +4.1.1 SCRIPT_PATH + Specify the absolute path of the script directory. + (default: /etc/systemtap/script.d) + +4.1.2 CONFIG_PATH + Specify the absolute path of the script config directory. + (default: /etc/systemtap/conf.d) + +4.1.3 CACHE_PATH + Specify the absolute path of the parent directory of the cache directory. + (default: /var/cache/systemtap) + +4.1.4 TEMP_PATH + Specify the absolute path of the temporary directory on which systemtap + initscript make temporary directories to compile scripts. + (default: /tmp) + +4.1.5 STAT_PATH + Specify the absolute path of the running status directory. + (default: /var/run/systemtap) + +4.1.6 LOG_FILE + Specify the absolute path of the log file + (default: /var/log/systemtap.log) + +4.1.7 PASSALL + If this is set 'yes', systemtap initscript will fail when it fails + to run one of the scripts. If not, systemtap initscript will not + fail(just warn). + (default: yes) + +4.1.8 RECURSIVE + If this is set 'yes', systemtap initscript will always follow script + dependencies. This means, you don't need to specify '-R' option. This flag is + effective only if you specify script(s) from command line. + (default: no) + +4.1.9 AUTOCOMPILE + If this is set 'yes', systemtap initscript automatically tries to compile + specified script if there is no valid cache. Otherwides, it just fails to + run script(s). + (default: yes) + +4.1.10 DEFAULT_START + Specify scripts which will be started by default. If omitted (or empty), + all scripts in the script directory will be started. + (default: "") + +4.1.11 ALLOW_CACHEONLY + If this is set 'yes', systemtap initscript list up cache-only scripts too. + *NOTE*: systemtap initscript will load unexpected obsolete caches with this + option. You should check cache directory before enabling this option. + (default: no) + +4.2 Script Parameters + +4.2.1 _OPT + Specify options passed to stap command for each script. "script-name" is the + name of the script file without the suffix extension(.stp). + Some options are just ignored. And even if you don't specify -F option, + systemtap initscript always add it for flight recorder mode. + - Below options are ignored when compiling script. + -p,-m,-r,-c,-x,-e,-s,-o,-h,-V,-k + - Below options are ignored when starting script. + -h,-V,-v,-t,-p,-I,-e,-R,-r,-m,-k,-g,-P,-D,-b,-u,-q,-w,-l,-d,-L,-F, and + other long options. + +4.2.2 _REQ + Specify script dependency(which script this script requires). + For example, "foo.stp" script requires(or run after) "bar.stp" script, set + + foo_REQ="bar" + + If the script requires many scripts, set all scripts separated by spaces. + + foo_REQ="bar baz" + +4.3 Configuration Example + +4.3.1 Global Config Example +--- +SCRIPT_PATH=/var/systemtap/script.d/ +PASSALL=yes +RECURSIVE=no +--- + +4.3.2 Script Config Example +--- +script1_OPT="-o /var/log/script1.out -DRELAYHOST=group1" +script2_OPT="-DRELAYGUEST=group1" +script2_REQ=script1 +--- + +5. How to use +============= + +5.1 Package Installation + After installing systemtap package, install systemtap-initscript package. + # yum install systemtap-initscript + This package will include initscript and default configuration file and + other files. + +5.2 Script installation +5.2.1 Installing script files + Copy a systemtap script ("script1.stp") into script directory. + # cp script1.stp /etc/systemtap/script.d/ + +5.2.2 Configuration script options + Add configuration file to specify options. + # vi /etc/systemtap/conf.d/group1 + script1_OPT="-o /var/log/group1.log -DRELAYHOST=group1" + +5.2.3 Installing script file with dependency + For example, a script("script2.stp") which shares buffer with another + script("script1.stp"), there is a dependency. In this case, you just do + as following. + + # cp script2.stp /etc/systemtap/script.d/ + # vi /etc/systemtap/conf.d/group1 + script2_OPT="-DRELAYGUEST=group1" + script2_REQ=script1 + + In this case, if stap fails to run script1.stp, systemtap initscript will + not run script2.stp. + +5.3 Testing + After installing all scripts, please make sure to run service successfully. + # service systemtap start + # service systemtap stop + If there is no error, we are ready to use it. + +5.4 Service Enabling + After all test passed, enable systemtap initscript. + # chkconfig systemtap on + +5.5 Adding script +5.5.1 Installing and configuring new scripts + Copy new systemtap script("script3.stp") into script directory. + # cp script3.stp /etc/systemtap/script.d/ + and configure it. + # vi /etc/systemtap/conf.d/group1 + script3_OPT="-DRELAYGUEST=group1" + script3_REQ="script1" + +5.5.2 Start new script + If you've already started systemtap initscript, just start new script. + # service systemtap start script3 + +5.6 Deleting script +5.6.1 Deleting old script + Remove old script ("script2.stp") and remove configure lines + # rm /etc/systemtap/script.d/script2.stp + # vi /etc/systemtap/conf.d/group1 + (delete script2_OPT and script2_REQ) + +5.6.2 Stopping old script and cleanup + Stop old script. + # service systemtap stop script2 + And cleanup the script caches. + # service systemtap cleanup script2 + +5.7 Updating kernel + Usually, you don't need to do anything. Systemtap initscript checks the + kernel version when starting the service, and compile scripts. + (If you would like to use compiled scripts due to lack of compiler or + debuginfo on the system, see 5.8) + However, if you want to avoid compiling when booting system, you can prepare + script caches for new kernel. + # service systemtap compile -r + +5.8 Using with compiled scripts + Sometimes, production systems don't have any compilation environment. Even + though, you can use systemtap initscript with compiled scripts as script + caches, which are compiled on other machine (but same software environment). + +5.8.1 Preparing compiled scripts + As described in 5.2, installing scripts and configure it on the compiling + machine (which has compilation environment). + After that, compile those scripts. + # service systemtap compile -r + And package the compiled scripts and configuration file. + # tar czf stap-scripts-.tar.gz \ + /var/cache/systemtap/ /etc/systemtap/conf.d/ + And copy this package to the target machine. + +5.8.2 Installing pre-compiled scripts + On the target machine, unpackage the compiled scripts into cache + directory. + # tar xzf stap-scripts-.tar.gz -C /var/cache/systemtap/ + # mv /var/cache/systemtap/ /etc/systemtap/conf.d/ + At last, set AUTOCOMPILE=no and ALLOW_CACHEONLY=yes in config file. + # vi /etc/systemtap/config + AUTOCOMPILE=no + ALLOW_CACHEONLY=yes diff --git a/initscript/config b/initscript/config deleted file mode 100644 index c49a34a5..00000000 --- a/initscript/config +++ /dev/null @@ -1,20 +0,0 @@ -# Path setup -# SCRIPT_PATH=/etc/systemtap/script.d -# CONFIG_PATH=/etc/systemtap/conf.d -# CACHE_PATH=/var/cache/systemtap -# STAT_PATH=/var/run/systemtap -# TEMP_PATH=/tmp -# LOG_FILE=/var/log/systemtap.log - -# Fail unless all scripts succeeded to run -# PASSALL=yes - -# Always follows script dependencies -# RECURSIVE=no - -# Automatically recompile scripts if caches are old or do not exist. -# AUTOCOMPILE=yes - -# Start these scripts by default. If omitted, all scripts are started. -# DEFAULT_START= - diff --git a/initscript/config.stap-server b/initscript/config.stap-server new file mode 100644 index 00000000..baadbf28 --- /dev/null +++ b/initscript/config.stap-server @@ -0,0 +1,6 @@ +# Path setup +# CONFIG_PATH=/etc/stap-server/conf.d +# STAT_PATH=/var/run/stap-server +# TEMP_PATH=/tmp +# LOG_FILE=/var/log/stap-server.log +# STAP_USER=stap-server \ No newline at end of file diff --git a/initscript/config.systemtap b/initscript/config.systemtap new file mode 100644 index 00000000..c49a34a5 --- /dev/null +++ b/initscript/config.systemtap @@ -0,0 +1,20 @@ +# Path setup +# SCRIPT_PATH=/etc/systemtap/script.d +# CONFIG_PATH=/etc/systemtap/conf.d +# CACHE_PATH=/var/cache/systemtap +# STAT_PATH=/var/run/systemtap +# TEMP_PATH=/tmp +# LOG_FILE=/var/log/systemtap.log + +# Fail unless all scripts succeeded to run +# PASSALL=yes + +# Always follows script dependencies +# RECURSIVE=no + +# Automatically recompile scripts if caches are old or do not exist. +# AUTOCOMPILE=yes + +# Start these scripts by default. If omitted, all scripts are started. +# DEFAULT_START= + diff --git a/initscript/stap-server.in b/initscript/stap-server.in index 72059130..8522ca1b 100644 --- a/initscript/stap-server.in +++ b/initscript/stap-server.in @@ -5,15 +5,8 @@ # chkconfig: - 00 99 # description: The systemtap compile server provides a centralized and secure \ # environment for compiling systemtap scripts. -# config: /etc/stap-server/config +# config: /etc/sysconfig/stap-server # config: /etc/stap-server/conf.d -### BEGIN INIT INFO -# Provides: Systemtap compile server management -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Short-Description: Manage systemtap compile servers -# Description: The systemtap compile server provides a centralized and secure environment for compiling systemtap scripts. -### END INIT INFO BINDIR=@bindir@ @@ -31,6 +24,7 @@ STAP_STOP_SERVER=$BINDIR/stap-stop-server UNAME=/bin/uname # Path setup +CONFIG_FILE=/etc/sysconfig/stap-server CONFIG_PATH=/etc/stap-server/conf.d STAT_PATH=/var/run/stap-server TEMP_PATH=/tmp @@ -44,16 +38,16 @@ STAP_USER=stap-server OPT_KERNEL_ARCH=`stap_get_arch` # A list of release_arch pairs OPT_SERVER_LIST= - -CONFIG=/etc/stap-server/config +# Optional global config file +OPT_CONFIG_FILE= echo_usage () { echo $"Usage: $prog {start|stop|restart|status} [option]" echo $"Options:" - echo $" -a arch : change the target architecture" echo $" -c configfile : specify config file" - echo $" -i : specify all installed kernel releases" + echo $" -a arch : change the target architecture" echo $" -r release : specify a kernel release" + echo $" -i : specify all installed kernel releases" echo $"" echo $"All options, except -c may be specified more than once." echo $"" @@ -70,7 +64,8 @@ echo_usage () { echo $"" echo $"If no kernel release is specified, the defaults are as follows:" echo $"" - echo $" start: start a server for the kernel release of the host platform." + echo $" start: start a server for the kernel release and architecture of" + echo $" the host platform." echo $" stop: stop all servers." echo $" restart: restart all servers." echo $" status: report the status of all servers." @@ -96,10 +91,6 @@ logex () { # command "$@" >> "$LOG_FILE" 2>&1 return $? } -do_warning () { # message - slog "Warning: $1" - warning "$1" -} do_failure () { # message slog "Error: $1" failure "$1" @@ -108,28 +99,6 @@ do_success () { # message log "Pass: $1" success "$1" } -# Normalize options -check_bool () { # value - case $1 in - n|N|no|No|NO|0) - return 0;; - y|Y|yes|Yes|YES|1) - return 1;; - *) - return 2;; - esac -} -ask_yesno () { # message - local yn ret=2 - while [ $ret -eq 2 ]; do - echo -n "$1 [y/N]: " - read yn - [ -z "$yn" ] && return 0 - check_bool $yn - ret=$? - done - return $ret -} #------------------------------------------------------------------ # Parameter parsing and setup options @@ -139,11 +108,11 @@ parse_args () { # arguments while [ -n "$1" ]; do case "$1" in -a) - process_a $2 + OPT_KERNEL_ARCH=$2 shift 1 ;; -c) - CONFIG=$2 + OPT_CONFIG_FILE=$2 shift 1 ;; -i) @@ -164,14 +133,10 @@ parse_args () { # arguments done test error = 1 && echo_usage && return 1 + test [ -z "$OPT_SERVER_LIST" ] && OPT_SERVER_LIST=`default_server_list` return 0 } -# Process the -a flag. -process_a () { - OPT_KERNEL_ARCH=$1 -} - # Process the -i flag. process_i () { local save_arch=$OPT_KERNEL_ARCH @@ -210,36 +175,6 @@ process_r () { return 0 } -CMD=$1 -shift 1 -OPTS=`getopt -s bash -u -o 'a:c:ir:' -- $@` -if [ $? -ne 0 ]; then - slog "Error: Argument parse error: $@" - failure $"parse error" - echo_usage - exit 3 -fi -parse_args $OPTS || exit 3 - -# Include configs -if [ -f "$CONFIG" ]; then - . "$CONFIG" -fi - -for f in "$CONFIG_PATH"/*.conf; do - if [ -f "$f" ]; then - . "$f" - fi -done - -prepare_stat_dir () { - if [ ! -d "$STAT_PATH" ]; then - logex mkdir -p "$STAT_PATH" - [ $? -ne 0 ] && return 1 - fi - return 0 -} - # Default to the currently running kernel release get_release () { # server-spec if [ -z "$1" ]; then @@ -254,20 +189,49 @@ get_arch () { # server-spec if [ -z "$1" ]; then stap_get_arch else - expr "$spec" : '.*_\(.*\)' + expr "$1" : '.*_\(.*\)' + fi +} + +load_config () { + # Include configs + if [ -f "$CONFIG_FILE" ]; then + . "$CONFIG_FILE" + fi + if [ -f "$OPT_CONFIG_FILE" ]; then + . "$OPT_CONFIG_FILE" + fi + + CONFIG_OPTS= + for f in "$CONFIG_PATH"/*.conf; do + if [ -f "$f" ]; then + # Obtain an architecture and release from each config file. + # Ensure that we get the default architecture and release if they + # are not specified. + ARCH= + RELEASE= + . "$f" + [ -z "$ARCH" ] && ARCH=`get_arch` + [ -z "$RELEASE" ] && RELEASE=`get_release` + CONFIG_OPTS="$CONFIG_OPTS -a $ARCH -r $RELEASE" fi + done +} + +prepare_stat_dir () { + if [ ! -d "$STAT_PATH" ]; then + logex mkdir -p "$STAT_PATH" + [ $? -ne 0 ] && return 1 + fi + return 0 } stat_file () { # server-spec echo $STAT_PATH/$1 } -get_server_list () { - if [ -z "$OPT_SERVER_LIST" ]; then - echo "`get_release`_`get_arch`" - return 0 - fi - echo "$OPT_SERVER_LIST" +default_server_list () { + echo "`get_release`_`get_arch`" } check_server_running () { # server-spec @@ -293,7 +257,7 @@ managed_servers () { echo "$list" } -start () { # release arch +start () { prepare_stat_dir if [ $? -ne 0 ]; then do_failure $"Failed to make stat directory ($STAT_PATH)" @@ -301,10 +265,9 @@ start () { # release arch fi # Start each requested server in turn - local server_list=`get_server_list` local spec local first=1 - for spec in $server_list; do + for spec in $OPT_SERVER_LIST; do local release=`get_release $spec` local arch=`get_arch $spec` @@ -353,8 +316,8 @@ stop () { first=0 clog $"Stopping $prog for $release_arch: " -n + local server_status_file=`stat_file $server_status` if check_server_running $server_status; then - local server_status_file=`stat_file $server_status` local pid=`cat $server_status_file` runuser -s /bin/bash - $STAP_USER -c "$STAP_STOP_SERVER $pid" fi @@ -368,17 +331,17 @@ stop () { status () { local server_list + local rc=0 # Report status for the specified servers or all servers, if none specified. if [ -n "$OPT_SERVER_LIST" ]; then server_list="$OPT_SERVER_LIST" else server_list=`managed_servers` - fi - - if [ -z "$server_list" ]; then - echo "No managed stap-server is running" - return 0 + if [ -z "$server_list" ]; then + echo "No managed stap-server is running" + return 3 + fi fi local server_status @@ -387,6 +350,7 @@ status () { local server_status_file=`stat_file $server_status` if [ ! -f $server_status_file ]; then echo "stap-server for $release_arch is not running" + rc=3 else local pid=`cat $server_status_file` if check_server_running $server_status; then @@ -394,13 +358,15 @@ status () { else echo "stap-server for $release_arch started as PID $pid is no longer running" rm -f $server_status_file + rc=1 fi fi done - return 0 + + return $rc } -# Restart scripts +# Restart or start if not running function restart () { local server_list @@ -411,41 +377,93 @@ function restart () { server_list=`managed_servers` fi + OPT_SERVER_LIST=$server_list + stop + echo + start + return $? +} + +# Restart only if running +function condrestart () { + local server_list + + # Restart the specified servers or all servers, if none specified, + # But only if they are already running. + if [ -n "$OPT_SERVER_LIST" ]; then + server_list="$OPT_SERVER_LIST" + else + server_list=`managed_servers` + fi + if [ -z "$server_list" ]; then clog "No managed stap-server is running" -n do_success "No managed stap-server is running" return 0 fi + OPT_SERVER_LIST=$server_list stop echo - OPT_SERVER_LIST=$server_list start return $? } +#------------------------------------------------------------------ +# Mainline script +#------------------------------------------------------------------ +load_config +CMD=$1 +shift 1 +OPTS=`getopt -s bash -u -o 'a:c:ir:' -- $CONFIG_OPTS $@` +if [ $? -ne 0 ]; then + slog "Error: Argument parse error: $@" + failure $"parse error" + echo_usage + exit 2 +fi + RETVAL=0 case $CMD in start) + parse_args $OPTS || exit 2 + parse_args $CONFIG_OPTS || exit 2 start RETVAL=$? ;; stop) + parse_args $OPTS || exit 2 stop RETVAL=$? ;; restart) + parse_args $OPTS || exit 2 restart RETVAL=$? ;; + condrestart|try-restart) + parse_args $OPTS || exit 2 + condrestart + RETVAL=$? + ;; status) + parse_args $OPTS || exit 2 status exit $? ;; - *) + reload) + RETVAL=0 + ;; + force-reload) + stop + load_config + start + RETVAL=$? + ;; + usage|*) echo_usage - RETVAL=3 + RETVAL=0 ;; esac diff --git a/systemtap.spec b/systemtap.spec index 860fe283..1c520f2e 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -121,9 +121,13 @@ Summary: Instrumentation System Server Group: Development/System License: GPLv2+ URL: http://sourceware.org/systemtap/ -Requires: systemtap initscripts +Requires: systemtap Requires: avahi avahi-tools nss nss-tools mktemp Requires: zip unzip +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts %description server This is the remote script compilation server component of systemtap. @@ -144,7 +148,11 @@ Summary: Systemtap Initscripts Group: Development/System License: GPLv2+ URL: http://sourceware.org/systemtap/ -Requires: systemtap-runtime, initscripts +Requires: systemtap-runtime +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts %description initscript Initscript for Systemtap scripts @@ -268,18 +276,19 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/*.pdf docs.installed/ mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/tapsets docs.installed/ %endif -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d/ -install -m 755 initscript/systemtap $RPM_BUILD_ROOT%{_sysconfdir}/init.d/ +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ +install -m 755 initscript/systemtap $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/conf.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/script.d -install -m 644 initscript/config $RPM_BUILD_ROOT%{_sysconfdir}/systemtap +install -m 644 initscript/config.systemtap $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/config mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/systemtap mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/systemtap -install -m 755 initscript/stap-server $RPM_BUILD_ROOT%{_sysconfdir}/init.d/ +install -m 755 initscript/stap-server $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server/conf.d +install -m 644 initscript/config.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/stap-server mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log touch $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server.log @@ -300,19 +309,37 @@ exit 0 chmod 664 %{_localstatedir}/log/stap-server.log chown stap-server %{_localstatedir}/log/stap-server.log chgrp stap-server %{_localstatedir}/log/stap-server.log -chkconfig --add stap-server +/sbin/chkconfig --add stap-server exit 0 %preun server -chkconfig --del stap-server +if [ $1 = 0 ] ; then + /sbin/service stap-server stop >/dev/null 2>&1 + /sbin/chkconfig --del stap-server +fi +exit 0 + +%postun server +if [ "$1" -ge "1" ] ; then + /sbin/service stap-server condrestart >/dev/null 2>&1 || : +fi exit 0 %post initscript -chkconfig --add systemtap +/sbin/chkconfig --add systemtap exit 0 %preun initscript -chkconfig --del systemtap +if [ $1 = 0 ] ; then + /sbin/service systemtap stop >/dev/null 2>&1 + /sbin/chkconfig --del systemtap +fi +exit 0 + +%postun initscript +if [ "$1" -ge "1" ] ; then + /sbin/service systemtap condrestart >/dev/null 2>&1 || : +fi exit 0 %post @@ -395,11 +422,12 @@ exit 0 %{_bindir}/stap-server-connect %{_bindir}/stap-sign-module %{_mandir}/man8/stap-server.8* -%{_sysconfdir}/init.d/stap-server +%{_sysconfdir}/init.d/rc.d/stap-server %dir %{_sysconfdir}/stap-server %dir %{_sysconfdir}/stap-server/conf.d +%config(noreplace) %{_sysconfdir}/stap-server/config %{_localstatedir}/log/stap-server.log -%doc initscript/README.initscript +%doc initscript/README.stap-server %files sdt-devel %defattr(-,root,root) @@ -408,14 +436,14 @@ exit 0 %files initscript %defattr(-,root,root) -%{_sysconfdir}/init.d/systemtap +%{_sysconfdir}/rc.d/init.d/systemtap %dir %{_sysconfdir}/systemtap %dir %{_sysconfdir}/systemtap/conf.d %dir %{_sysconfdir}/systemtap/script.d %config(noreplace) %{_sysconfdir}/systemtap/config %dir %{_localstatedir}/cache/systemtap %dir %{_localstatedir}/run/systemtap -%doc initscript/README.initscript +%doc initscript/README.systemtap %if %{with_grapher} %files grapher -- cgit