1)Write a script that schedules the message \"Hi!\" to be displayed a minute lat
ID: 3812010 • Letter: 1
Question
1)Write a script that schedules the message "Hi!" to be displayed a minute later. Run that script. You can use atq to see if it's scheduled. Wait a minute. Write the answer to the following question as comments in your code: why isn't your message showing up
2)You may have several terminals opened at the same time. If you want the output to be visible on your current terminal, you can use tty to know its address, and send your output there. For example:
#!/bin/bash echo "Hi" > `tty`
Using this, write a script that schedules the message "Hi!" to be displayed a minute later. Be careful that you really have to use the slanted quotes ` `
Explanation / Answer
First of all we need to write our script and we need to save that script
let our script be
#!/bin/bash
echo "Hi" > `tty`
We need to save this scrip, I saved this script with the name SampleScript.sh
In order to schedule this script we in linux we need to use cron tab.
Cron tab is nothing but it is a command is used to schedule commands to be executed periodically based on intervals we provided.
* * * * * /bin/execute/this/SampleScript.sh
here there are 5 stars which means
* minute (from 0 to 59)
* hour (from 0 to 23)
* day of month (from 1 to 31)
* month (from 1 to 12)
* day of week (from 0 to 6) (0=Sunday)
So as per our recuirement is to run the script every minute we need to place " * * * * * ".This script is being executed every minute.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.