-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove.sh
26 lines (23 loc) · 923 Bytes
/
remove.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# Program:
# AutoWaterPi 移除
# History:
# 2021/12/2
#取得現在的路徑
#https://www.ltsplus.com/linux/shell-script-get-script-location
get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"
# While $SOURCE is a symlink, resolve it
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
# If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "$DIR"
}
BASEDIR=$(get_script_dir)
crontab -u root -l | grep -v $BASEDIR/capture.py | crontab -u root -
crontab -u root -l | grep -v $BASEDIR/check.py | crontab -u root -
#https://askubuntu.com/questions/408611/how-to-remove-or-delete-single-cron-job-using-linux-command