Posts: 2
pronto5703
Joined: 16 Mar 2015
#1
Cheers all.

For some old folks I'm busy with this Thinkpad as writen in my signature. They use this laptop maby once or twice a month, so I want each time they use it that it is fully updated.

Please note that I am new with this, and follow guideliness I found. Therefore, I'm not completely sure what I'm writing.
I wrote:
#!/bin/sh
/usr/bin/apt-get -y update
/usr/bin/apt-get -y dist-upgrade
/usr/bin/apt-get -y autoremove
/usr/bin/apt-get -y autoclean
exit 0

and saved in / etc/init.d

I tried to symlink with
update-rc.d MYSCRIPT start 20 5 . stop 20 5
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'S01updatescriptje' missing LSB tags and overrides
insserv: warning: script 'updatescriptje' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (0 1 2 3 4 5 6 S) of script `updatescriptje' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (empty) of script `updatescriptje' overrides LSB defaults (0 1 6).
insserv: can not symlink(../init.d/updatescriptje,
../rc5.d/S20updatescriptje): File exists

Something is missing, so I took a look in the other scripts in init.d. Updated my script to:

#!/bin/sh

### BEGIN INIT INFO
# Provides: updatescriptje
# Required-Start:
# Required-Stop:
# Default-Start: 5
# Default-Stop: 5
# Short-Description: script update
### END INIT INFO

/usr/bin/apt-get -y update
/usr/bin/apt-get -y dist-upgrade
/usr/bin/apt-get -y autoremove
/usr/bin/apt-get -y autoclean
exit 0

This gives errors in update-rc-d will overrides LSB defaults.
Changed script to:

#!/bin/sh

### BEGIN INIT INFO
# Provides: updatescriptje
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 5
# Short-Description: script update
### END INIT INFO

/usr/bin/apt-get -y update
/usr/bin/apt-get -y dist-upgrade
/usr/bin/apt-get -y autoremove
/usr/bin/apt-get -y autoclean
exit 0

Than
update-rc.d updatescriptje defaults
which gave again the override errors.

I gave up and
ln -s / etc/init.d/updatescriptje / etc/rc5.d
which gave me also a symbolic link.

But during boot there is no apt-get update.

Changed script back to only:
#!/bin/sh
/usr/bin/apt-get -y update
/usr/bin/apt-get -y dist-upgrade
/usr/bin/apt-get -y autoremove
/usr/bin/apt-get -y autoclean
exit 0

Resulted in still no update process.

As solution I am looking for an automatic update procedure each time this machine is turned on, and it must be complete before it shows the desktop GUI. This to avoid they press all buttons.

I want to know exactly what to write and place where.

Thanks a lot.


$ inxi -r
Repos: Active apt sources in file: / etc/apt/sources.list.d/antix.list
deb
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://antix.daveserver.info/stable/"
linktext was:"http://antix.daveserver.info/stable/"
====================================
stable main
Active apt sources in file: / etc/apt/sources.list.d/debian.list
deb
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://ftp.hu.debian.org/debian/"
linktext was:"http://ftp.hu.debian.org/debian/"
====================================
wheezy main contrib non-free
deb
========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://security.debian.org/"
linktext was:"http://security.debian.org/"
====================================
wheezy/updates main contrib non-free


$ inxi -zv7
System: Host: antiX Kernel: 3.7.10-antix.7-486-smp i686 (32 bit gcc: 4.7.2)
Desktop: JWM 2.1.0 dm: slim
Distro: antiX-13.2_386-full Luddite 4 November 2013
Machine: Mobo: IBM model: 26284VG
Bios: IBM v: IWET48WW (1.04 ) date: 12/21/1999
CPU: Single core Pentium III (Coppermine) (-UP-) cache: 256 KB
flags: (pae sse) bmips: 1194 speed/min/max: 600/500/600 MHz
Memory: Using dmidecode: you must be root to run dmidecode
Graphics: Card: Advanced Micro Devices [AMD] ATI Rage Mobility P/M AGP 2x
bus-ID: 01:00.0 chip-ID: 1002:4c4d
Display Server: X.Org 1.12.4 drivers: ati (unloaded: fbdev,vesa) FAILED: mach64
Resolution: 1024x768@87.0hz
GLX Renderer: Gallium 0.4 on softpipe
GLX Version: 2.1 Mesa 8.0.5 Direct Rendering: Yes
Audio: Card Cirrus Logic CS 4614/22/24/30 [CrystalClear SoundFusion Audio Accelerator]
driver: snd_cs46xx bus-ID: 00:05.0 chip-ID: 1013:6003
Sound: ALSA v: k3.7.10-antix.7-486-smp
Network: Card: Intel 82557/8/9/0/1 Ethernet Pro 100
driver: e100 v: 3.5.24-k2-NAPI port: 1800
bus-ID: 00:03.0 chip-ID: 8086:1229
IF: eth0 state: up speed: 100 Mbps duplex: full mac: <filter>
WAN IP: <filter> IF: irda0 ip: N/A ip-v6: N/A
IF: eth0 ip: <filter> ip-v6: <filter>
Drives: HDD Total Size: 40.0GB (12.7% used)
ID-1: /dev/sda model: HTS424040M9AT00 size: 40.0GB serial: MPA25CQ4G08HSE
Optical: /dev/sr0 model: MATSHITA DVD-ROM SR-8174
rev: C221 dev-links: cdrom,dvd
Features: speed: 24x multisession: yes
audio: yes dvd: yes rw: none state: running
Partition: ID-1: / size: 35G used: 2.9G (9%) fs: ext4 dev: /dev/sda1
label: N/A uuid: 2454b2c6-cf1c-4c57-a1f7-6aa6adac8816
ID-2: swap-1 size: 2.18GB used: 0.00GB (0%) fs: swap dev: /dev/sda2
label: N/A uuid: ceaa9538-002b-49b4-82f7-b8d0c2b125d2
RAID: No RAID data: /proc/mdstat missing-is md_mod kernel module loaded?
Unmounted: No unmounted partitions detected
Sensors: System Temperatures: cpu: 53.0C mobo: 49.0C
Fan Speeds (in rpm): cpu: 0
Info: Processes: 77 Uptime: 1:42 Memory: 172.8/246.9MB
Init: SysVinit v: 2.88 runlevel: 5 default: 5 Gcc sys: 4.7.2
Client: Shell (bash 4.2.371 running in roxterm) inxi: 2.2.16
Posts: 2,238
dolphin_oracle
Joined: 16 Dec 2007
#2
I wouldn't run that as part of the init system. sometimes services get updated and you might want a settled system before applying the updates.

One thing to check...is your script executable?

if you really want to run that at boot, put the call to the update script in / etc/rc.local before the exit 0. rc.local is the last script to run before x starts.

if you want to avoid potential pitfalls with the update, I wouldn't run the apt-get autoremove or apt-get autoclean unattended. you're not likely to save more than a few MB on deleting lib files, and sometimes those processes can go awry.

something to consider... this could make boot up an extremely long event. Even running with the stable repos, if something like libreoffice gets updated upstream (and that does happen sometimes) then you could be looking at 200 MB+ downloads during your boot process. and an awful lot of scrolling text for whomever booted up that machine.
Posts: 2
pronto5703
Joined: 16 Mar 2015
#3
Thank you for your reply.

I want to run an automatic apt-get update during, or after, boot BEFORE the GUI desktop shows up.

I made the script executable with chmod +x namescript

Edit rc.local to:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will"exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/home/gabi/Documents/updatescriptje
exit 0

and

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will"exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sleep 10
/home/gabi/Documents/updatescriptje
exit 0

But nothing happens during boot.

What I do wrong?
It would be very kind to know how what rc.local must contains exactly to make it work.

Thanks agian.
anticapitalista
Posts: 5,955
Site Admin
Joined: 11 Sep 2007
#4
You could try using cron-apt


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://www.techrepublic.com/article/automatically-update-your-ubuntu-system-with-cron-apt/"
linktext was:"http://www.techrepublic.com/article/aut ... -cron-apt/"
====================================
Posts: 1
asaoppenheimer
Joined: 17 Jun 2015
#5
during boot thats mean while staring system?
Posts: 119
wildstar84
Joined: 31 May 2014
#6
Rather than in init, I think you should probably add the"apt-get update" command to [slash]etc[slash]rc.local