Skip to content
Snippets Groups Projects
Commit db4cb617 authored by Martin Strbacka's avatar Martin Strbacka
Browse files

mail_notifier: Forced usage of busybox's date.

parent 58c7bb43
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ fi
message="$3"
# This should be unique
msg_id="$(date +%s)-$$"
msg_id="$(/bin/busybox date +%s)-$$"
mkdir -p "$base_dir"
mkdir "$base_dir/tmp.$msg_id"
......
#!/bin/sh
base_folder=/tmp/user_notify
date_cmd="/bin/busybox date"
if [ "$1" = "-d" ] ; then
base_folder="$2"
......@@ -91,7 +92,7 @@ schedule_restart() {
local max_delay=10
local delay=`uci get user_notify.reboot.delay`
local time=`uci get user_notify.reboot.time | tr -d ':'`
local curr_time=`date +"%H%M"`
local curr_time=`$date_cmd +"%H%M"`
if [ $delay -gt $max_delay ]; then
delay=$max_delay
......@@ -101,11 +102,11 @@ schedule_restart() {
delay=1
fi
local curr_date=`date '+%y%m%d'`
local curr_date=`$date_cmd '+%y%m%d'`
local wanted_time="$(($curr_date + $delay))$time"
echo "reboot" | at -t $(date +"%y%m%d%H%M" -d "$wanted_time")
echo -e "Zařízení bude automaticky restartováno dne $(date +'%d. %m. %Y v %H:%M' -d $wanted_time).\n" >> $1
echo "reboot" | at -t $($date_cmd +"%y%m%d%H%M" -d "$wanted_time")
echo -e "Zařízení bude automaticky restartováno dne $($date_cmd +'%d. %m. %Y v %H:%M' -d $wanted_time).\n" >> $1
}
compose_message() {
......@@ -115,8 +116,8 @@ compose_message() {
local severity=`uci get user_notify.notifications.severity`
local news=`uci get user_notify.notifications.news`
local curr_date=`date -R`
local date_time=`date +'%y%m%d.%H%M%S'`
local curr_date=`$date_cmd -R`
local date_time=`$date_cmd +'%y%m%d.%H%M%S'`
local rand=`tr -dc A-Za-z0-9 < /dev/urandom 2>/dev/null | head -c8`
local domain=`uci get user_notify.smtp.from | cut -d '@' -f2`
local msg_id="<$date_time.$rand@$domain>"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment