set PATH to make sure find all commands when execute script from crontab

This commit is contained in:
Roger Pàmies Fabra 2023-07-26 01:04:47 +02:00
parent d6900f9e35
commit 56646e8083
6 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# uncomment when use script from cron
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# variables # variables
LOGFILE="$(hostname)_chkrootkit-$(date +'%Y-%m-%d').txt"; LOGFILE="$(hostname)_chkrootkit-$(date +'%Y-%m-%d').txt";
GOTIFY_MESSAGE="Scan init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r" GOTIFY_MESSAGE="Scan init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# uncomment when use script from cron
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# variables # variables
LOGFILE="$(hostname)_clamav-$(date +'%Y-%m-%d').log"; LOGFILE="$(hostname)_clamav-$(date +'%Y-%m-%d').log";
GOTIFY_MESSAGE="Scan init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r" GOTIFY_MESSAGE="Scan init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# uncomment when use script from cron
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# variables # variables
LOGFILE="$(hostname)_rkhunter-$(date +'%Y-%m-%d').log"; LOGFILE="$(hostname)_rkhunter-$(date +'%Y-%m-%d').log";
GOTIFY_MESSAGE="Scan init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r" GOTIFY_MESSAGE="Scan init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# uncomment when use script from cron
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
#verify run as root or sudo #verify run as root or sudo
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" echo "This script must be run as root"

View File

@ -2,6 +2,9 @@
#Use ./gotifypush <title> <message> <priority> <token> <clickurl> #Use ./gotifypush <title> <message> <priority> <token> <clickurl>
# uncomment when use script from cron
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# Gotify notification parameters # Gotify notification parameters
TITLE=$1 TITLE=$1
MESSAGE=$2 MESSAGE=$2

View File

@ -2,6 +2,9 @@
#Use ./logger.sh <logfile> <relativepath> #Use ./logger.sh <logfile> <relativepath>
# uncomment when use script from cron
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
# variables # variables
REMOTE_PATH="$ES7_LOGS_PATH$2" REMOTE_PATH="$ES7_LOGS_PATH$2"
PUBLIC_LOG_URL="$ES7_LOGS_URL/$2" PUBLIC_LOG_URL="$ES7_LOGS_URL/$2"