0

I have the following shell script:

#!/bin/bash
time=$(time);
imagesnap -q "/var/captures/$time.jpg";

When I run it in the terminal, everything works. But when I run it using launchtl or crontab at login, nothing happens.

Does anyone know how to run this script at login? It it even possible?

Thanks for any answers in advance!

Note

The issue is not with crontab or launchctl, I have got them to work. They just wont work with the camera.

I am using Imagesnap as a dependency for capturing images.

My Machine

I am using macOS 14.1 Beta 2 on a 2021 macBook Pro

2
  • Does this help?
    – Seamus
    Commented Oct 6, 2023 at 0:44
  • Is the command running as root or under your account? Is it possible to set a delay before calling imagesnap, maybe the camera isn't set up yet.
    – ErniePC12
    Commented Oct 6, 2023 at 2:06

1 Answer 1

1

You could use the Automator application to create a application to run the script, as shown below.

You could then add this application to the items that will open automatically when you log in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .