Script Files
Every time swatch launches, it creates a script that it runs. If you don’t indicate a specific location for the scripts, they will be saved in the home directory of the user who launches the process. They are hidden files, beginning with a dot, so you must use the ls -la
command to review the script files:
ls -la ~/.swa*
-rw-r--r-- 1 root root 3191 Nov 10 16:00 /root/.swatch_script.26536
-rw-r--r-- 1 root root 3194 Nov 10 16:59 /root/.swatch_script.31296
-rw-r--r-- 1 root root 3189 Nov 10 17:01 /root/.swatch_script.31724
-rw-r--r-- 1 root root 3545 Nov 10 17:09 /root/.swatch_script.32244
It is a good idea to organize these scripts in their own directory. To do this, we add --script-dir=
to our command that launches swatch. You can use whatever directory you prefer as long as the user running swatch has write permissions on the directory. I will use /tmp/swatch/
. An example of the new command to launch swatch is:
mkdir -p /tmp/swatch
/usr/bin/swatch --daemon \
--config-file=/tmp/swatch.conf \
--tail-file=/var/log/test.log \
--script-dir=/tmp/swatch
As a word of caution, do not delete scripts in the script-dir directory unless you are sure they is no longer in use. The safest way is to shutdown swatch, delete the files, then restart swatch.