Skip to content

Commit

Permalink
luci-mod-system: reload crond upon saving crontab
Browse files Browse the repository at this point in the history
Fixes: #5184
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  • Loading branch information
jow- committed Jul 15, 2021
1 parent 7d9ab8d commit 8d4ac60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ return view.extend({
return fs.write('/etc/crontabs/root', value).then(function(rc) {
document.querySelector('textarea').value = value;
ui.addNotification(null, E('p', _('Contents have been saved.')), 'info');

return fs.exec('/etc/init.d/cron', [ 'reload' ]);
}).catch(function(e) {
ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message)));
});
Expand All @@ -24,9 +26,7 @@ return view.extend({
render: function(crontab) {
return E([
E('h2', _('Scheduled Tasks')),
E('p', { 'class': 'cbi-section-descr' },
_('This is the system crontab in which scheduled tasks can be defined.') +
_('<br/>Note: you need to manually restart the cron service if the crontab file was empty before editing.')),
E('p', { 'class': 'cbi-section-descr' }, _('This is the system crontab in which scheduled tasks can be defined.')),
E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 10, 'disabled': isReadonlyView }, [ crontab != null ? crontab : '' ]))
]);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
},
"write": {
"file": {
"/etc/crontabs/root": [ "write" ]
"/etc/crontabs/root": [ "write" ],
"/etc/init.d/cron reload": [ "exec" ]
},
"ubus": {
"file": [ "write" ]
Expand Down

0 comments on commit 8d4ac60

Please sign in to comment.