You can create a Unix script that checks for user logins and logouts by monitoring the /var/log/auth.log
or /var/log/secure
file, depending on your Unix distribution. Use the last
command to list users who have logged in, and last -x
to include system shutdowns and runlevel changes, which indicate logouts. Schedule the script to run every minute using a cron job with the command * * * * * /path/to/your/script.sh
. Ensure the script captures the output and reports the findings, perhaps by appending the results to a log file.
A Unix script is not necessary. The zip utility has the capability of compressing the files with a password.
Unix is inherently portable; this means that a program, script, or process may be moved from Unix system to Unix system with little effort or change (hence - portable).
Essentially, a command in Unix is a program that you execute for a certain purpose. It could be anything, from a shell script, to copying or deleting files, etc.
Actually, just about anything you want to do. Depends on the job function requirements.
Use the 'uname -a' command. It reports on the Unix system, version, machine name, amongst other things.
You really don't want to do this in a shell script - scripting languages in Unix typically do not handle or work with floating values, only integers. A better way would be to write a program to do this that works under Unix, such as a 'C" program. See the related link for an example
# SS29 # Script to delete all lines containing the word 'unix' from files supplied as arguments # Usage: SS29 file1 file2 file3 ... if [$# -lt 2] then echo Insufficient arguments exit fi for file do grep -v unix $file>/temp/$file cp /temp/$file $file done
Use the 'script' command; it captures everything you are doing and stores it into a file.
The cron facility of Unix allows periodic tasks to be started. You need to add a scheduler entry to cron (via crontab) in the form: minute hour dom month day-of-week So the entry: 0,15 3-5 * 12 0 /run/some/script would run the file /run/som/script on the hour and 15 minutes past the hour, from 3 - 5 a.m. every day of the month for December if the day is a Sunday.
Errors can occur in a script - you can check the return status of any command to see if part of the script fails. For scripts that are production ready they should always exit with some status, in case one script calls another. In that case you would need to check the status of the called script.
du is a command the reports on the Disk Usage of the filesystem.
For any Unix or Linux based operating system, make the text file readable and executable and then invoke (call) it by the file name, which will execute the script.