DevOps Classroom Series – 25/Sept/2020

What is cronjob or Scheduled Job?

  • Cronjobs are jobs (scripts, executables) that you want to run on a particular schedule (Specific time, periodic) on Linux based systems. (Schedule Jobs are for Windows)
  • Cronjob uses the following format
MIN HOUR DOM MON DOW CMD
  • Now Lets execute a script called as fullbackup.sh in the directory /opt/backups/fullbackup.sh
30 08 10 * * /opt/backups/fullbackup.sh

Jenkins

  • Jenkins is cron/scheduler on Steriods to run CI/CD activities Preview
  • How to install Jenkins Master on Linux Machines?

Installation in Ubuntu

sudo apt update
sudo apt install openjdk-8-jdk -y
java -version
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
    /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
  • Now navigate to http://<ipaddress&gt;:8080 Preview Preview Preview Preview Preview Preview Preview Preview

  • To install specific version of jenkins refer here

  • What happened during installation

    • Jenkins creates a user and a group called as jenkins Preview
    • This means when we run any job from jenkins ui the job will be executed on the linux machine as jenkins user
    • Lets login as jenkins user and verify certain items Preview
    • Jenkins stores all of its data in the directory referred as JENKINS HOME DIRECTORY. In our case is /var/lib/jenkins
    • Now lets create a simple jenkins job/project Preview Preview Preview Preview Preview Preview Preview
    • Now navigate into jenkins home directory and explore jobs folder. You will findout jenkins job which we created on ui is stored as an xml file <projectname>/config.xml Preview Preview
    • Lets change our job to create a file as part of build Preview Preview

Summary

  • When we install jenkins a user called as jenkins and a group called Jenkins will be created.
  • When we create jobs, jobs are stored as xml files in jenkins home directory/jobs folder
  • When we execute jobs, Jenkins uses workspace folder.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin