I want to create a script to perform an apt-get upgrade and schedule to run weekly (maybe daily).
The script could be a simple
The script could be a simple
but what about if apt-get is already running (just in case). From what I can tell, apt checks that the file /var/lib/apt/lists/lock is not open. If it is open, then it won't run. I was thinking of using a while statement to have the script sleep until the file is no longer open, but I can't find a test to check if the file is open or not.#!/bin/bash
apt-get update
apt-get upgrade -y
apt-get autoclean