commit 0d5055af7124c3325219a369e914ed2d79264360
parent ba6cc6947aa3449e53ac3fb4316179eca046428b
Author: Daniel Moch <daniel@danielmoch.com>
Date: Thu, 1 Feb 2018 06:02:19 -0500
Rearrange cron files
Diffstat:
5 files changed, 12 insertions(+), 29 deletions(-)
diff --git a/.config/cron/crontab b/.config/cron/crontab
@@ -1,26 +0,0 @@
-# Edit this file to introduce tasks to be run by cron.
-#
-# Each task to run has to be defined through a single line
-# indicating with different fields when the task will be run
-# and what command to run for the task
-#
-# To define the time you can provide concrete values for
-# minute (m), hour (h), day of month (dom), month (mon),
-# and day of week (dow) or use '*' in these fields (for 'any').#
-# Notice that tasks will be started based on the cron's system
-# daemon's notion of time and timezones.
-#
-# Output of the crontab jobs (including errors) is sent through
-# email to the user the crontab file belongs to (unless redirected).
-#
-# For example, you can run a backup of all your user accounts
-# at 5 a.m every week with:
-# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
-#
-# For more information see the manual pages of crontab(5) and cron(8)
-#
-# m h dom mon dow command
-*/5 * * * * $HOME/.config/cron/weather.sh > $HOME/.local/var/log/weather 2>&1
-*/15 * * * * $HOME/.config/cron/vdirsyncer.sh > $HOME/.local/var/log/vdirsyncer 2>&1
-*/15 * * * * $HOME/.config/cron/photosync.sh > $HOME/.local/var/log/photosync 2>&1
-
diff --git a/.local/bin/my-init b/.local/bin/my-init
@@ -49,7 +49,6 @@ then
type crontab > /dev/null 2>&1 && crontab -r > /dev/null 2>&1
fi
-# Terminfo
if __has "infocmp" "tic" && [ ! -d "$HOME/.terminfo" ]
then
echo " Initializing Termcaps"
@@ -61,7 +60,6 @@ then
fi
fi
-# Lesskey
if __has "lesskey" && [ ! -f "$HOME/.less" ]
then
echo " Initializing .less"
@@ -71,7 +69,18 @@ fi
if __has "crontab"
then
echo " Installing crontab"
- cat "$HOME/.config/cron/crontab" | crontab -
+ cron_dir="$HOME/.local/lib/cron"
+ log_dir="$HOME/.local/var/log"
+ cat > /tmp/crontab.$$ <<-EOF
+# m h dom mon dow command
+*/5 * * * * $cron_dir/weather.sh > $log_dir/weather 2>&1
+*/15 * * * * $cron_dir/vdirsyncer.sh > $log_dir/vdirsyncer 2>&1
+*/15 * * * * $cron_dir/photosync.sh > $log_dir/photosync 2>&1
+
+EOF
+ cat /tmp/crontab.$$ | crontab
+ rm /tmp/crontab.$$
+ unset cron_dir log_dir
fi
# Vim plugins
diff --git a/.config/cron/photosync.sh b/.local/lib/cron/photosync.sh
diff --git a/.config/cron/vdirsyncer.sh b/.local/lib/cron/vdirsyncer.sh
diff --git a/.config/cron/weather.sh b/.local/lib/cron/weather.sh