Automate Reboot and Git push with Linux Crontab

1200px-Tux.svg

Introduction

I am going to explain how you can set up daily git pushes with crontab command.

Step 1 – Disable git username/password prompt during check-in

Follow the steps on this StackOverflow post.

Step 2 – Add git commands to a sh file

Add following sh file to the repository root directory.

#!/usr/bin/expect

#Pull remote repository
git pull

#Git commit and push
git add -A

#Commit
git commit -a -m "Daily Update"
git push

Step 3 – Open Crontab

sudo crontab -e

Step 4 – Setup Daily Executions

Add following line to the crontab file. This will run the script every 8am in the morning.

0 8 * * * PATH_TO_YOUR_SH_FILE

For example, the command I used was this.

0 8 * * * /home/myhome/project/gitpush.sh

Step 5 – Setup Daily Reboot

Refer to this askUbuntu post to set this up.

 

Set up Ubuntu Mate on Raspberry PI for Python Developers

Raspi-PGB001

Introduction

This blog explains how to set up a freshly installed Ubuntu mate on a Raspberry PI for Python and Django development. If you want to know how to install Ubuntu Mate on Raspberry PI please refer to this post.

Step 1 – Enable SSH

Not really needed for this task. But handy to have it. Run the following two commands to activate it.

sudo systemctl enable ssh
sudo systemctl start ssh

Step 2 – Update Ubuntu

Run following two commands. These two will take 1-2 hours to finish.

sudo apt-get update
sudo apt-get upgrade

Step 3 – Install Importent Packages

sudo apt-get install git
sudo apt install vim

Step 4 – Install Python/Django

sudo apt install python-pip -y
pip install --upgrade pip 
sudo python -m pip install django

Install Ubuntu Mate in Raspberry PI using Mac and no Keyboard

Raspi-PGB001

Introduction

In this blog, I am going to explain how you can install your Raspberry PI using a mac and without any keyboards. Also, you need minimal technical knowledge to do so. You will need a mouse and a display device. So here it goes.

Step 1 – Download Ubuntu Mate

Get it from the following link. Then extract it to get the .img file.

https://ubuntu-mate.org/raspberry-pi/

Step 2 – Plug Micro SD card to your Mac

Connect your Micro USB card to the mac. If your mac is a new (fancy) one with only Thunderbolt ports you can buy a micro SD card adapter from Amazon for a couple of bucks.

Step 3 – Find the Device Identifier

Mac will auto-mount your micro sd card. Go to the Disk Utility, select your SD card. Note the disk identifier of your card. For my case, it is disk4. Then unmount your disk (do not Eject).

Screen Shot 2019-03-09 at 4.26.54 PM

Step 4 – Write Ubuntu Mate image to the SD card

Here is the command you should execute.

sudo dd bs=1m if=path_of_your_image.img of=identifier_of_your_disk conv=sync

For my case, here is the exact command I had to run.

sudo dd bs=1m if=~/downloads/ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img of=/dev/disk4 conv=sync

This command takes some time to complete, so stay put.

Step 5 – Boot your Raspberry

Plugin the micro sd. You need to connect a mouse and display to it as well. Turn on the raspberry and boot it up.

Step 6 – Set up username/password without a Keyboard

When it boots up it will ask you to give a login and a password. But you can’t do it because you don’t have a keyboard. The trick is to copy any text from the window and paste it on the login and password text boxes. For this example, I used “computer” username and “computercomputer” as the password. Set it up, you are good to go.

Step 7 – Enable On Screen Keyboard

Go to Applications–> Universal Access –> Onboard

Hope this helps. Refer this blog to see how you can set up Ubuntu Mate after installation for programming.