Session-63 | Schedule Future Jobs/Tasks Using AT & CRONTAB in Linux (RHEL 8) | Nehra Classes

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น • 31

  • @harendrasingh1457
    @harendrasingh1457 4 หลายเดือนก่อน +2

    nice session

  • @avijeetmajumder8338
    @avijeetmajumder8338 ปีที่แล้ว +1

    excellence on excellent level sir.

  • @gouravrelhan7372
    @gouravrelhan7372 ปีที่แล้ว +1

    thank you so much

  • @pravinnilee8150
    @pravinnilee8150 2 ปีที่แล้ว +1

    Great Session .

  • @sakaldeep11
    @sakaldeep11 ปีที่แล้ว +1

    Crontab 28:35

  • @JoyfulJourney73
    @JoyfulJourney73 2 ปีที่แล้ว +4

    please dont stop your hard work. you are great

  • @ajaykumar-cq9vu
    @ajaykumar-cq9vu 11 หลายเดือนก่อน

    Class starts 3:57

  • @sharathsundar7722
    @sharathsundar7722 6 หลายเดือนก่อน

    Hi @Nehra sir,
    I have a question - If anacron executes the commands whenever the system is turned On, how will the source machine will get to know that the target machine is turned On.
    Will the source machine be running some background checks or pings.
    Pls explain.

    • @NehraClasses
      @NehraClasses  5 หลายเดือนก่อน

      Anacron is a job scheduler used on Unix-like operating systems to execute commands periodically with a frequency specified in days. Unlike cron, which assumes that the system is always running, Anacron is designed for systems that are not always powered on.
      Anacron does not natively provide a way for one machine (the source machine) to know when another machine (the target machine) is turned on.

  • @MrPrabhu666
    @MrPrabhu666 ปีที่แล้ว +1

    Hi Sir ,
    how to schedule cron for other user apart from root and schedule jobs and i need to get a mail for the script in cron.

    • @NehraClasses
      @NehraClasses  5 หลายเดือนก่อน

      Scheduling cron jobs for a user other than root and setting up email notifications involves a few steps. Here’s a detailed guide:
      ### **1. Scheduling a Cron Job for a Specific User**
      To schedule a cron job for a user other than root, you need to edit that user’s crontab file. Here’s how to do it:
      1. **Switch to the User (if you are root or using `sudo`):**
      ```bash
      sudo su - username
      ```
      Replace `username` with the target user’s name.
      2. **Edit the User’s Crontab:**
      ```bash
      crontab -e
      ```
      This opens the crontab file for the user in the default text editor.
      3. **Add a Cron Job:**
      Add the cron job in the following format:
      ```bash
      * * * * * /path/to/script.sh
      ```
      Replace `* * * * *` with the desired schedule and `/path/to/script.sh` with the path to your script.
      Example to run a script every day at 3 AM:
      ```bash
      0 3 * * * /home/username/scripts/myscript.sh
      ```
      4. **Save and Exit:**
      Save the file and exit the editor. The cron job is now scheduled.
      ### **2. Scheduling a Cron Job as Root for Another User**
      If you need to schedule a cron job for another user from the root account, use the following steps:
      1. **Edit the System-Wide Crontab:**
      You can edit the system-wide crontab file to schedule jobs for other users:
      ```bash
      sudo nano /etc/crontab
      ```
      Add a line specifying the user, schedule, and command:
      ```bash
      * * * * * username /path/to/script.sh
      ```
      Replace `username` with the target user’s name and adjust the schedule and script path as needed.
      2. **Save and Exit:**
      Save the changes and exit the editor.
      ### **3. Setting Up Email Notifications for Cron Jobs**
      To receive email notifications for cron jobs, ensure the following:
      1. **Mail Transfer Agent (MTA) Configuration:**
      - Make sure an MTA like `sendmail`, `postfix`, or `exim` is installed and configured on your system. This allows cron to send emails.
      2. **Set `MAILTO` in Crontab:**
      Add the `MAILTO` environment variable to the user’s crontab file or the system-wide crontab file to specify the recipient email address:
      ```bash
      MAILTO="your-email@example.com"
      ```
      Example crontab entry:
      ```bash
      MAILTO="your-email@example.com"
      0 3 * * * /home/username/scripts/myscript.sh
      ```
      If `MAILTO` is not set, cron will send the email to the user account running the cron job by default.
      ### **4. Verify Cron Job Execution**
      1. **Check Logs:**
      - Verify if the cron job executed and if emails were sent:
      ```bash
      sudo grep CRON /var/log/syslog
      ```
      - On some systems, cron logs are stored in `/var/log/cron` or `/var/log/cron.log`.
      2. **Test the Script:**
      - Run the script manually to ensure it works correctly and check for any issues.
      By following these steps, you can schedule cron jobs for users other than root and ensure you receive email notifications for the execution of these jobs.

  • @RaoShahzaib
    @RaoShahzaib ปีที่แล้ว +1

    Love you sir

  • @pravinnilee8150
    @pravinnilee8150 2 ปีที่แล้ว +1

    at now +2min -m and at now +2min -M
    can you please explain this command again? you have mention we can get email by using m option, where can we see mail

  • @aksharma9952
    @aksharma9952 2 ปีที่แล้ว

    What is different between jobs should and Crontab

  • @ShubhamKumar-uf9bm
    @ShubhamKumar-uf9bm ปีที่แล้ว

    Sir whtat is the command for the show output in the terminal

  • @ganeshshinde8288
    @ganeshshinde8288 2 ปีที่แล้ว +2

    Best'

  • @arpitgupta4972
    @arpitgupta4972 2 ปีที่แล้ว +1

    best

  • @dipankarroy7350
    @dipankarroy7350 ปีที่แล้ว

    Sir If I execute any job in every 90 min through crontab how can I do that?

    • @surajbhopi6161
      @surajbhopi6161 ปีที่แล้ว

      30 1 * * * type your schedule job

    • @NehraClasses
      @NehraClasses  ปีที่แล้ว

      You have to set two jobs for this task

  • @depisacreation3169
    @depisacreation3169 ปีที่แล้ว

    Where is session 64?

    • @NehraClasses
      @NehraClasses  ปีที่แล้ว

      Available in the playlist for the members

  • @bhaderwahi.gupshap5026
    @bhaderwahi.gupshap5026 ปีที่แล้ว

    Sir app ne dhere dhere sab video membersship k liye kar d. 😢😢😢

    • @NehraClasses
      @NehraClasses  ปีที่แล้ว +1

      Dheere dheere se nahi, properly announce karke hi lagayi hai. Aur next month se poora course standard nahi balki advanced level par access hoga.
      Jab na koi share kar rha hai a likes target complete kar rha hai, ulta log videos download karke rakh lete hain to hame bhi membership lagani hi padi.

  • @VinodOfficial-d6u
    @VinodOfficial-d6u ปีที่แล้ว

    please make videos in english

  • @nekraah9455
    @nekraah9455 ปีที่แล้ว

    Hindi sub translation very disturbing

    • @NehraClasses
      @NehraClasses  ปีที่แล้ว

      you have the option to turn it off or auto transcribe to your language.