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 is cron/scheduler on Steriods to run CI/CD activities
- How to install Jenkins Master on Linux Machines?
Installation in Ubuntu
- Refer Here for ubuntu steps documentation
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>:8080
To install specific version of jenkins refer here
What happened during installation
- Jenkins creates a user and a group called as jenkins
- 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
- 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
- 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
- Lets change our job to create a file as part of build
- 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.