adding crontab editor
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user