[SOLVED] Crontab Shutdown Command Continues Even After Deletion

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Collisteru
Level 1
Level 1
Posts: 15
Joined: Sat Feb 20, 2021 3:46 pm

[SOLVED] Crontab Shutdown Command Continues Even After Deletion

Post by Collisteru »

Hello.

About a month ago, I established a crontab command on my computer to shut it down automatically at 22:00.

I don't remember the exact command, but it was something very simple like:

Code: Select all

* 22 * * * root shutdown -h now
Later, I decided I didn't need the command anymore and used crontab -r to delete it.

Despite this, the crontab still runs every night, shutting down my computer when I don't expect it.

Output of crontab -e (/tmp/crontab.d70uw6/crontab):

Code: Select all

Jul 12 22:00:01 Myrmidon CRON[40247]: (root) CMD (   shutdown -h now)
Jul 12 22:00:01 Myrmidon CRON[40248]: (root) CMD (timeshift --check --scripted)
Jul 12 22:00:01 Myrmidon kernel: [50211.987870] audit: type=1400 audit(1626148801.827:497): apparmor="ALLOWED" operation="signal" profile="libreoffice-oopslash" pid=13060 comm="oosplash" requested_mask="send" denied_mask="send" signal=kill peer="libreoffice-soffice"
Jul 12 22:00:01 Myrmidon kernel: [50211.987873] audit: type=1400 audit(1626148801.827:498): apparmor="ALLOWED" operation="signal" profile="libreoffice-soffice" pid=13060 comm="oosplash" requested_mask="receive" denied_mask="receive" signal=kill peer="libreoffice-oopslash"
Jul 12 22:00:01 Myrmidon pulseaudio[1232]: ICE default IO error handler doing an exit(), pid = 1232, errno = 11
The var/spool/cron/crontabs directory is empty.

Relevant excerpt in /var/log/syslog.1:

Code: Select all

Jul 12 22:00:01 Myrmidon CRON[40247]: (root) CMD (   shutdown -h now)
Jul 12 22:00:01 Myrmidon CRON[40248]: (root) CMD (timeshift --check --scripted)
Jul 12 22:00:01 Myrmidon kernel: [50211.987870] audit: type=1400 audit(1626148801.827:497): apparmor="ALLOWED" operation="signal" profile="libreoffice-oopslash" pid=13060 comm="oosplash" requested_mask="send" denied_mask="send" signal=kill peer="libreoffice-soffice"
Jul 12 22:00:01 Myrmidon kernel: [50211.987873] audit: type=1400 audit(1626148801.827:498): apparmor="ALLOWED" operation="signal" profile="libreoffice-soffice" pid=13060 comm="oosplash" requested_mask="receive" denied_mask="receive" signal=kill peer="libreoffice-oopslash"
Jul 12 22:00:01 Myrmidon pulseaudio[1232]: ICE default IO error handler doing an exit(), pid = 1232, errno = 11
Output of inxi -Fxxxrz:

Code: Select all

inxi -Fxxxrz
System:
  Kernel: 5.8.0-59-generic x86_64 bits: 64 compiler: N/A 
  Desktop: Xfce 4.14.2 tk: Gtk 3.24.13 info: xfce4-panel wm: xfwm4 
  dm: LightDM 1.30.0 Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal 
Machine:
  Type: Convertible System: Dell product: Inspiron 5406 2n1 v: N/A 
  serial: <filter> Chassis: type: 31 serial: <filter> 
  Mobo: Dell model: 0VMRNH v: A00 serial: <filter> UEFI: Dell v: 1.4.1 
  date: 03/30/2021 
Battery:
  ID-1: BAT0 charge: 37.5 Wh condition: 37.5/39.8 Wh (94%) volts: 12.6/11.2 
  model: BYD DELL CF5RH0A type: Unknown serial: <filter> status: Full 
  Device-1: hid-0018:04F3:2A81.0001-battery model: CUST0000:00 04F3:2A81 
  serial: N/A charge: N/A status: N/A 
CPU:
  Topology: Quad Core model: 11th Gen Intel Core i7-1165G7 bits: 64 
  type: MCP arch: Tiger Lake rev: 1 L2 cache: 12.0 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 13516 
  Speed: 1444 MHz min/max: 400/1700 MHz Core speeds (MHz): 1: 1331 2: 1222 
  3: 1153 4: 1568 
Graphics:
  Device-1: Intel vendor: Dell driver: i915 v: kernel bus ID: 00:02.0 
  chip ID: 8086:9a49 
  Display: x11 server: X.Org 1.20.9 driver: modesetting unloaded: fbdev,vesa 
  compositor: compton v: 0.1~beta2+20150922 resolution: 1920x1080~60Hz 
  OpenGL: renderer: Mesa Intel Xe Graphics (TGL GT2) v: 4.6 Mesa 20.2.6 
  direct render: Yes 
Audio:
  Device-1: Intel vendor: Dell driver: sof-audio-pci bus ID: 00:1f.3 
  chip ID: 8086:a0c8 
  Sound Server: ALSA v: k5.8.0-59-generic 
Network:
  Device-1: Intel driver: iwlwifi v: kernel port: 3000 bus ID: 00:14.3 
  chip ID: 8086:a0f0 
  IF: wlp0s20f3 state: up mac: <filter> 
  IF-ID-1: virbr0 state: up speed: 10 Mbps duplex: unknown mac: <filter> 
  IF-ID-2: virbr0-nic state: down mac: <filter> 
  IF-ID-3: vnet0 state: unknown speed: 10 Mbps duplex: full mac: <filter> 
Drives:
  Local Storage: total: 953.87 GiB used: 152.89 GiB (16.0%) 
  ID-1: /dev/nvme0n1 vendor: Samsung model: PM981a NVMe 1024GB 
  size: 953.87 GiB speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: 15304129 
  scheme: GPT 
Partition:
  ID-1: / size: 329.73 GiB used: 152.80 GiB (46.3%) fs: ext4 
  dev: /dev/nvme0n1p7 
Sensors:
  System Temperatures: cpu: 49.0 C mobo: N/A 
  Fan Speeds (RPM): cpu: 0 
Repos:
  No active apt repos in: /etc/apt/sources.list 
  Active apt repos in: /etc/apt/sources.list.d/christian-boxdoerfer-fsearch-daily-focal.list 
  1: deb http://ppa.launchpad.net/christian-boxdoerfer/fsearch-daily/ubuntu focal main
  Active apt repos in: /etc/apt/sources.list.d/deadsnakes-ppa-focal.list 
  1: deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main
  Active apt repos in: /etc/apt/sources.list.d/google-chrome.list 
  1: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/home:bgstack15:Chicago95.list 
  1: deb http://download.opensuse.org/repositories/home:/bgstack15:/Chicago95/xUbuntu_20.04/ /
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 
  1: deb http://mintmirror.math.washington.edu/linuxmint-repo ulyssa main upstream import backport
  2: deb http://mirror.team-cymru.org/ubuntu focal main restricted universe multiverse
  3: deb http://mirror.team-cymru.org/ubuntu focal-updates main restricted universe multiverse
  4: deb http://mirror.team-cymru.org/ubuntu focal-backports main restricted universe multiverse
  5: deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
  6: deb http://archive.canonical.com/ubuntu/ focal partner
Info:
  Processes: 232 Uptime: 20h 45m Memory: 15.37 GiB used: 7.87 GiB (51.2%) 
  Init: systemd v: 245 runlevel: 5 Compilers: gcc: 9.3.0 alt: 9 Shell: bash 
  v: 5.0.17 running in: xfce4-terminal inxi: 3.0.38 
Why is the crontab still running, even though by every indication it is deleted? How can I get it to stop, and what is the significance of CRON[402477]?

Thank you, as always, for your help.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Crontab Shutdown Command Continues Even After Deletion

Post by rene »

You missed the crontab -e output (although I expect you meant crontab -l anyway) but I in any case expect you installed the shutdown command as root's crontab, i.e., through sudo. To confirm, sudo crontab -l and to delete if so sudo crontab -r.
Collisteru
Level 1
Level 1
Posts: 15
Joined: Sat Feb 20, 2021 3:46 pm

Re: Crontab Shutdown Command Continues Even After Deletion

Post by Collisteru »

Good idea, but sudo crontab -l returns "no crontab for root," and crontab -l returns "no crontab for sean."
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Crontab Shutdown Command Continues Even After Deletion

Post by rene »

... which I could've known since you in fact already said that /var/spool/cron/crontabs was empty.

This is to say that you have not installed your shutdown command as a user crontab. Did you plonk something directly into e.g. /etc/cron.daily/ or one of the other /etc/cron.*/ directories or even more directly into /etc/anacrontab? Your log shows cron executing things, i.e., we are not talking about a systemd timer here... which is to say that if neither of the foregoing, this seems to make no sense.
1000
Level 6
Level 6
Posts: 1039
Joined: Wed Jul 29, 2020 2:14 am

Re: Crontab Shutdown Command Continues Even After Deletion

Post by 1000 »

Check /var/spool/cron/crontabs/ this is good idea
You can also check
viewtopic.php?p=1973411#p1973411
Collisteru
Level 1
Level 1
Posts: 15
Joined: Sat Feb 20, 2021 3:46 pm

Re: Crontab Shutdown Command Continues Even After Deletion

Post by Collisteru »

1000, Thank you for directing me to those search strings. Using them, I was able to find /etc/crontab, a file I had missed on all my earlier searches for some reason. Therein was the culprit, my original crontab shutdown command. I'll need a few more hours to make sure deleting the cron command did indeed work, but for now it appears this problem is SOLVED.
Locked

Return to “Scripts & Bash”