Creating Syslog entries and generating an alarm
In this section, 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.
Getting ready
Besides having a terminal open, we need to make sure you have a file to make an entry.
How to do it...
- We are going to use the
logger
command to enterfile_name
into thesyslog
file. Run the following command:
$ logger -f file_name
- 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:
#!/bin/bash declare -i H declare -i M declare -i cur_H declare -i cur_M declare -i min_left declare -i hour_left echo -e "What time do you Wake Up?" read H echo -e "and Minutes?" read M cur_H=`date +%H` cur_M=`date +%M` echo "You Selected " echo "$H:$M" echo -e "\nIt is Currently $cur_H:...