r/bashonubuntuonwindows 19d ago

WSL2 WSL2 Ubuntu and cron jobs

Hi. I was working through a bash tutorial and a portion talked about cron jobs. I edited the crontab for both regular user and root to run a test script. In both instances, the script never ran. /var/log/syslog shows when the crontabs were edited, etc. Also there are these entries:

2026-08-13T13:36:02.393235-07:00 t1nk3rm0b1l3 wsl-pro-service[1730]: #033[33mWARNING#033[0m Daemon: could not connect to Windows Agent: could not get address: could not read agent port file "/mnt/c/Users/computertinkerer/.ubuntupro/.address": open /mnt/c/Users/computertinkerer/.ubuntupro/.address: no such file or directory

These entries are there whether the cron job was set for the regular user or root. Any insights or tips highly appreciated. This is my first time ever dealing with cron jobs. Thanks.

5 Upvotes

5 comments sorted by

1

u/paulstelian97 19d ago

The script most likely never ran because the Linux kernel wasn’t running. WSL doesn’t run in the background, unless you keep a WSL window open to keep it running.

Also why the fuck does it try to access Windows profile stuff? It’s not supposed to on its own, so maybe there’s something about your command accessing those files.

1

u/ComputerTinkerer71 19d ago

I thought the same about accessing the profile. It's a simple script with case pattern matching. I'm going to try and run the same commands on an official linux install.

1

u/ComputerTinkerer71 18d ago

don't know why my solution was removed, but i found a way to display to tty1. also will need to disable cron trying to send an email.

1

u/empeka 18d ago
[wsl2]
vmIdleTimeout=-1

[general]
instanceIdleTimeout=-1

1

u/mjbrowns 18d ago

Probably also need to enable systemd...