In this article, we are going to discuss the syslog protocol. We’ll also learn about the
logger command, which is a shell command and acts as an interface for the syslog module. The
logger command makes entries in the system log. In this section, we are also going to create an alarm using a script.
Besides having a terminal open, we need to make sure you have a file to make an entry.
We are going to use the
logger command to enter
file_name into the
syslog file. Run the following command:
Now we are going to write a script to create an alarm. Create a
create_alarm.sh script and write the following code in it:
How script works
Now we will see a description of the
logger command and the
create_alarm script we just wrote:
loggercommand made an entry about your file in the
syslogfile, which was in the
/var/logdirectory of your system. You can check that file. Navigate to the
/var/logdirectory and run
nano syslogand you will find the entry in that file.
- We created a script to create an alarm. We used the
datecommand for the date and time. We also used the
sleepcommand to block the alarm for that particular time.