How is the file format of /etc/crontab different from a normal crontab file? (Select TWO correct answers)
Answer(s): B,D
The /etc/crontab file is the system-wide crontab file that can be edited only by root. It has a different format from the normal crontab files that can be edited by individual users using the crontab command. The differences are:The /etc/crontab file can specify a year field as the sixth field in a cron entry. This allows for scheduling jobs that run only in specific years. The normal crontab files do not have a year field and assume the current year for all entries.The /etc/crontab file has a user field as the seventh field in a cron entry. This allows for running commands as different users from the crontab owner (root). The normal crontab files do not have a user field and run commands as the crontab owner.The /etc/crontab file does not need to be installed with the crontab command. It is read by the cron daemon automatically. The normal crontab files need to be installed with the crontab command to be recognized by the cron daemon.The /etc/crontab file and the normal crontab files both allow for environment variable substitution. However, the /etc/crontab file sets some default environment variables such as SHELL, PATH, MAILTO, and HOME, which can be overridden by entries in the file. The normal crontab files inherit the environment variables from the cron daemon, which are usually minimal.
crontab(5) - Linux manual pageLinux Crontab FormatHow to schedule a task using Linux crontab (/etc/crontab) file /etc/crontab - Linux Bash Shell Scripting Tutorial Wiki
What is the main difference between the batch and at commands?
Answer(s): B
The batch command is similar to the at command, except that it executes commands when the system load levels permit; in other words, when the load average drops below 1.5, or the value specified in the invocation of atd1. The at command allows us to schedule jobs using any of two commands: at and batch. While at runs commands at our specified time, batch runs commands when our system's load average is below 0.82. Both commands read commands from standard input or a specified file, and both commands send the output of the commands to the user by mail1. Therefore, the main difference between them is the time of execution: at runs at a fixed time, while batch runs when the system is idle.
1: Linux At, Batch, Atq, Atrm Command Help and Examples - Computer Hope 2: The "at" Command in Linux | Baeldung on Linux
The correct crontab entry to execute the script chklog three times per month between 3 p.m. and 5
Answer(s): C
The correct crontab entry to execute the script chklog three times per month between 3 p.m. and 5 p.m. is:3 15,16,17 * * * chklogThe crontab entry has five fields that specify the time and frequency of the job, followed by the command or script to be executed. The fields are:Minute: the minute of the hour when the job should run, from 0 to 59 Hour: the hour of the day when the job should run, from 0 to 23 (in 24-hour format) Day of month: the day of the month when the job should run, from 1 to 31 Month: the month of the year when the job should run, from 1 to 12 Day of week: the day of the week when the job should run, from 0 to 6 (where 0 and 7 are Sunday) The asterisk (*) means any value, and the comma (,) means a list of values. Therefore, the crontab entry above means:Run the job at the 3rd minute of the hourRun the job at the 15th, 16th, and 17th hour of the day (which are 3 p.m., 4 p.m., and 5 p.m.) Run the job on any day of the monthRun the job on any month of the yearRun the job on any day of the weekThis will execute the script chklog three times per day, every day of the month, and every month of the year, which is equivalent to three times per month.The other options are incorrect because:A . This will run the job at any minute of the hour, but only at the 3rd, 4th, and 5th hour of the day (which are 3 a.m., 4 a.m., and 5 a.m.), and only on the 1st day of the month. B . This will run the job at the 3rd minute of the hour, but only at the 3rd, 4th, and 5th hour of the day (which are 3 a.m., 4 a.m., and 5 a.m.), and only on the 1st day of the month.D . This will run the job at the 0th minute of the hour (which is the top of the hour), but only at the 15th, 16th, and 17th hour of the day (which are 3 p.m., 4 p.m., and 5 p.m.), and only on the 1st day of the month.E . This will run the job at any minute of the hour, but only at the 15th, 16th, and 17th hour of the day (which are 3 p.m., 4 p.m., and 5 p.m.), and only on the 1st day of the month.
Crontab Explained in Linux [With Examples]`crontab' in Linux with Examples - GeeksforGeeksLinux Crontab Command Help and Examples - Computer HopeCrontab in Linux with 20 Useful Examples to Schedule Jobs - TecAdmin Linux crontab tutorial with Examples - Linux Tutorials - Learn Linux ...
Fill in BlanksThe ________ command is used to add a group to the system.
Answer(s): A
The groupadd command creates a new group using the options specified on the command line and the default values from the /etc/login.defs file. It adds an entry for the new group to the /etc/group and /etc/gshadow files. Only the root user or a user with sudo privileges can create new groups using this command. The general syntax for the groupadd command is as follows:groupadd [OPTIONS] GROUPNAMESome of the common options for the groupadd command are:-g, --gid GID: Specify the numeric group ID for the new group. If not given, the system will assign the next available GID from the range of group IDs specified in the login.defs file. -r, --system: Create a system group with a GID chosen from the range of system group IDs specified in the login.defs file. System groups are usually used for some special system operation purposes, like creating backups or doing system maintenance.-f, --force: Suppress the error message if the group already exists and exit successfully. This option is useful for scripts that need to ensure the existence of a group. -K, --key KEY=VALUE: Override the default values from the /etc/login.defs file. The valid keys are GROUP_MIN_ID, GROUP_MAX_ID, SYS_GROUP_MIN_ID, SYS_GROUP_MAX_ID, and GID_INCREMENT.
https://www.makeuseof.com/linux-file-ownership-groups-guide/ https://linuxize.com/post/how-to-create-groups-in-linux/ https://linuxhandbook.com/groupadd-command/
Which command will set the local machine's timezone to UTC?
The command ln -s /usr/share/zoneinfo/UTC /etc/localtime will create a symbolic link from the file /etc/localtime to the file /usr/share/zoneinfo/UTC, which contains the binary time zone data for the UTC timezone. This will set the system's timezone to UTC, which is the Coordinated Universal Time, the primary time standard by which the world regulates clocks and time1. The /etc/localtime file is used by various system programs and libraries to determine the local time according to the configured timezone2. The /usr/share/zoneinfo directory contains the time zone information files for different regions and cities around the world3. The other commands are either invalid or will not change the system's timezone permanently. The command cat UTC > /etc/timezone will overwrite the /etc/timezone file with the string "UTC", which is not a valid timezone identifier. The /etc/timezone file is a plain text file that contains the name of the timezone, such as "America/New_York" or "Europe/Paris"4. The command date --timezone=UTC will display the current date and time in UTC, but will not change the system's timezone setting. The command mv /usr/timezone/UTC /etc will move the file /usr/timezone/UTC to the /etc directory, but this file does not exist by default and has no effect on the system's timezone configuration.
1:Coordinated Universal Time - Wikipedia 2: localtime(5) - Linux manual page 3: tz database - Wikipedia 4: How to Change or Set System Locales in Linux - Tecmint : date(1) - Linux manual page :How do I change my timezone to UTC/GMT? - Ask Ubuntu
Post your Comments and Discuss LPI 102-500 exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the 102-500 content, but please register or login to continue.