[dupe]Auto Update

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Locked
Shanther
Posts: 41
Joined: Sat Mar 04, 2017 3:12 pm

[dupe]Auto Update

Post by Shanther »

I am very new to Linux and have been learning about as much as I can. I love dietpi and have been using it on my ODROID XU4. I still have normal Rasbian on my Pi2 though.

On my pi I use cron-apt and found that dietpi has something similar already built in. dietpi-cron. In searching I found /etc/cron.daily/apt which has a lot of what I think I need in it already.

I need a way to make my device run 4 commands at 4 different times. How would I achieve this?

The commands and times I need are as follows.

1am - sudo apt-get update
2am - sudo apt-get upgrade --y
3am - sudo apt-get dist-upgrade --y
4am - sudo reboot

4 commands that I would like to run. If they have to run 1 after the other that works as well just not all at the same time for obvious reasons.

I saw some lines of code in the apt file that looked like those commands but de-activated but I have no idea how to read ANY code let alone re-write it. I have very basic understanding have have only gotten as far as I have through 50+ hours of reinstall and retry keeping logs of correct commands so by the end the entire process is written down. Every mistake I restarted. Slow going but in the end everything is smooth. Now this is just something to smooth that out.
Shanther
Posts: 41
Joined: Sat Mar 04, 2017 3:12 pm

Re: Auto Update

Post by Shanther »

bump.

All I want is a way to update, upgrade and reboot once done every day at 3am. Can anyone help with that?
Shanther
Posts: 41
Joined: Sat Mar 04, 2017 3:12 pm

Re: Auto Update

Post by Shanther »

Code: Select all

cd ..

sudo mkdir home

cd ../home

sudo mkdir jb

cd jb

sudo mkdir scripts

cd scripts

Code: Select all

sudo nano /home/jb/scripts/update



#!/bin/bash
apt-get update ; apt-get -y upgrade ; apt-get -y dist-upgrade ; apt-get clean ; apt-get -y autoremove ; reboot



Code: Select all

sudo crontab -e

0 3 * * * sudo bash /home/jb/scripts/update
Last edited by k-plan on Tue Jun 13, 2017 8:26 pm, edited 1 time in total.
Reason: Insert Code tags for better reading ....
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [dupe]Auto Update

Post by Fourdee »

If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Locked