From cebcff57687281c56c805ed024ea6f6b1d463ed6 Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Mon, 24 Jan 2022 18:38:45 -0500 Subject: [PATCH] adding crontab editor --- scripts/advanced.php | 1 + scripts/edit_crontab.php | 46 +++++++++++++++++++++++++++++++++++++ scripts/install_services.sh | 10 +++----- scripts/update_services.sh | 11 ++++----- 4 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 scripts/edit_crontab.php diff --git a/scripts/advanced.php b/scripts/advanced.php index f9aae7e..dd7ffef 100644 --- a/scripts/advanced.php +++ b/scripts/advanced.php @@ -140,6 +140,7 @@ if(isset($_SESSION['success'])){

+ diff --git a/scripts/edit_crontab.php b/scripts/edit_crontab.php new file mode 100644 index 0000000..72b1616 --- /dev/null +++ b/scripts/edit_crontab.php @@ -0,0 +1,46 @@ +Moved.', htmlspecialchars($url)); + exit(); +} + +// read the textfile +$text = file_get_contents($file); + +?> + + + + +
+ + +
+ +
+ diff --git a/scripts/install_services.sh b/scripts/install_services.sh index f1f311b..b76ec87 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -505,13 +505,9 @@ install_nomachine() { install_cleanup_cron() { echo "Installing the cleanup.cron" - if ! crontab -u ${USER} -l &> /dev/null;then - crontab -u ${USER} $(dirname ${my_dir})/templates/cleanup.cron &> /dev/null - else - crontab -u ${USER} -l > ${tmpfile} - cat $(dirname ${my_dir})/templates/cleanup.cron >> ${tmpfile} - crontab -u ${USER} "${tmpfile}" &> /dev/null - fi + echo $(dirname ${my_dir})/templates/cleanup.cron >> /etc/crontab + chown root:pi /etc/crontab + chmod g+rw /etc/crontab } install_selected_services() { diff --git a/scripts/update_services.sh b/scripts/update_services.sh index 75dbcb0..0b86ab2 100755 --- a/scripts/update_services.sh +++ b/scripts/update_services.sh @@ -500,13 +500,10 @@ install_nomachine() { install_cleanup_cron() { echo "Installing the cleanup.cron" - if ! crontab -u ${USER} -l &> /dev/null;then - crontab -u ${USER} $(dirname ${my_dir})/templates/cleanup.cron &> /dev/null - else - crontab -u ${USER} -l > ${tmpfile} - cat $(dirname ${my_dir})/templates/cleanup.cron >> ${tmpfile} - crontab -u ${USER} "${tmpfile}" &> /dev/null - fi + echo $(dirname ${my_dir})/templates/cleanup.cron >> /etc/crontab + chown root:pi /etc/crontab + chmod g+rw /etc/crontab + } install_selected_services() {