Daniel Stappenbeck
Daniel Stappenbeck

Reputation: 9

at-Command used on linux raspberry

I'm currently working on a Linux script on my Raspberry Pi, which should call another script with a time delay. I chose the "at command" for this and let python execute the code directly in the console.

import shlex
import subprocess
subprocess.call(shlex.split("at now + 5 minutes -f /home/raspberry/Desktop/Filename.py"))

When I run the "at command" directly in the console, I get the following feedback:

warning: commands will be executed using /bin/sh
job 13 at Sun Feb 19 23:17:00 2023

Unfortunately, nothing happens at the specified time and the script is not executed. The Filename.py Code is:

#!/usr/bin/env python3
print("Hallo Welt")

Does anyone have any ideas what I forgot or need to do differently?


Reply of /var/spool/mail/raspberry

From raspberry@raspberrypi Sun Feb 19 23:17:00 2023
Return-path: <raspberry@raspberrypi>
Envelope-to: raspberry@raspberrypi
Delivery-date: Sun, 19 Feb 2023 23:17:00 +0100
Received: from raspberry by raspberrypi.fritz.box with local (Exim 4.94.2)
    (envelope-from <raspberry@raspberrypi>)
    id 1pTrzQ-0000we-Fr
    for raspberry@raspberrypi; Sun, 19 Feb 2023 23:17:00 +0100
Subject: Output from your job       13
To: raspberry@raspberrypi
Message-Id: <[email protected]>
From: raspberry@raspberrypi
Date: Sun, 19 Feb 2023 23:17:00 +0100

sh: 47: Syntax error: word unexpected (expecting ")")

Upvotes: 0

Views: 191

Answers (0)

Related Questions