From ed0dac00683bf2a20792364af6c1cd58aa8573c7 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Tue, 28 Mar 2023 15:06:29 +1300 Subject: [PATCH] vault backup: 2023-03-28 15:06:29 --- content/notes/10-scheduled-tasks-and-logs.md | 37 ++++++++++++++++++++ content/notes/cosc-301.md | 1 + 2 files changed, 38 insertions(+) create mode 100644 content/notes/10-scheduled-tasks-and-logs.md diff --git a/content/notes/10-scheduled-tasks-and-logs.md b/content/notes/10-scheduled-tasks-and-logs.md new file mode 100644 index 000000000..b2cabe2e8 --- /dev/null +++ b/content/notes/10-scheduled-tasks-and-logs.md @@ -0,0 +1,37 @@ +--- +title: "10-scheduled-tasks-and-logs" +tags: +- lecture +- cosc301 +--- + +Daemon +- A process that runs in the background and is independent of control from all terminals +- Reasons for daemons’ independence of terminals + - Prevent daemons’ error message from appearing on a user’s terminal + - Signals generated from terminal keys must not affect any daemons that were started from that terminal earlier +- Typical daemons + - crond, syslogd + +Daemonization +``` +if( (pid = fork()) != 0) exit(0); //parent terminates +setsid(); // become session leader +signal(SIGHUP, SIG_IGN); if( (pid = fork()) != 0) exit(0); //new child continues +//now it becomes daemon +``` + +The purpose is to make the process independent of the control from any terminals. + +> [!INFO] when you are independent from + +Scheduled tasks +- Automating tasks + - crond and crontab + - crond is a very important daemon for automatically executing tasks + - Tasks can be configured to repeat hourly, daily, weekly,…, or even per minute. +- Possible uses + - Clean file systems + - Log rotate + - Check log files + - Monitor system status and resources \ No newline at end of file diff --git a/content/notes/cosc-301.md b/content/notes/cosc-301.md index f916b0fc7..08c2d1532 100644 --- a/content/notes/cosc-301.md +++ b/content/notes/cosc-301.md @@ -39,6 +39,7 @@ https://www.cs.otago.ac.nz/cosc301/schedule.php - [x] [[07-system-installation]] - [ ] [[08-post-installation]] - [ ] [[09-wireless-networking]] +- [ ] [[10-scheduled-tasks-and-logs]] # Info