A live bird collage card for your Home Assistant dashboard.
adding crontab editor
mcguirepr89cebcff576872
diff --git a/scripts/advanced.php b/scripts/advanced.phpindex f9aae7e1..dd7ffef8 100644--- a/scripts/advanced.php+++ b/scripts/advanced.php@@ -140,6 +140,7 @@ if(isset($_SESSION['success'])){<br><br><button type="text"><a href="config.php">Basic Settings</a></button>+ <button type="text"><a href="edit_crontab.php">Edit the Crontab</a></button></form></div></div>diff --git a/scripts/edit_crontab.php b/scripts/edit_crontab.phpnew file mode 100644index 00000000..72b1616f--- /dev/null+++ b/scripts/edit_crontab.php@@ -0,0 +1,46 @@+<?php++// configuration+$url = 'edit_crontab.php';+$file = '/etc/crontab';++// check if form has been submitted+if (isset($_POST['text']))+{+ // save the text contents+ file_put_contents($file, $_POST['text']);++ // redirect to form again+ header(sprintf('Location: %s', $url));+ printf('<a href="%s">Moved</a>.', htmlspecialchars($url));+ exit();+}++// read the textfile+$text = file_get_contents($file);++?>+<!-- HTML form -->+<head>+<style>+* {+ font-family: 'monospace';+}++a {+ text-decoration: none;+ color: black;+}++form {+ text-align: center;+}+</style>+<body style="background-color:rgb(119, 196, 135);">+<form style="height:95%" action="" method="post">+<input style="margin-left:-150px;" type="submit" value="Update" />+<input type="reset" value="Discard Changes" />+<button type="text"><a href="advanced.php">Back</a></button><br>+<textarea name="text" style="font-size:large;width:100%;height:95%;"><?php echo htmlspecialchars($text) ?></textarea>+</form>+</body>diff --git a/scripts/install_services.sh b/scripts/install_services.shindex f1f311bb..b76ec87a 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.shindex 75dbcb0a..0b86ab2b 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() {