How to Make My Cron Job Print to the Terminal?

0
0
Asked By TechWiz247 On

I've been trying to get the hang of cron jobs and shell scripts, but I'm facing an issue where nothing gets printed to the terminal. Here's a quick rundown of what I'm working with:

For my shell script located at /home/user/sayhello.sh, I've got the following code:
```bash
#!/bin/bash

wall "This message prints every minute."
```
In my crontab, I've set it up like this:
```
* * * * * DISPLAY=:0 xterm -e /home/user/sayhello.sh
```
It seems like the cron job is executing every minute since I checked the cron log, but I'm not seeing any output on the terminal. Any advice?

1 Answer

Answered By ScripterMaster On

So I tried just running the script like this in crontab:
```
* * * * * /home/user/sayhello.sh
```
but I didn't see any output either. It’s probably still a permission issue or the way you're invoking `wall`. Make sure your script runs fine outside the cron first!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.