Question

I made a shell script and registered to execute every 20 minutes. Here is my crontab code.

*/20 * * * * sh /mypath/run_myprocess.sh &> /dev/pts/34

I editted code like this in order to see whether my process run correctly.

I get the result '/dev/pts/34' from tty command in terminal.

However, does anyone know how to use linux command results(in this case: /dev/pts/34) in crontab? This is because I will use several terminal to run my tasks.

For example, in shell script, I can use linux command result in the form of $(command) such as

echo "$(date)"

directly.

Plus, if I type something on the terminal during process running with crontab, it actually gives result. For example,

Process is running........

ls
backup backup.sh Desktop Task_Folder shared_folder
[UserID] ~ # 

So I guess cron jobs run correctly but in background. Please help me to find out how can I bring cron jobs in foreground.

Was it helpful?

Solution

If you start a job on your console and background it you can then bring it to foreground. If the task is not yours or not started on your terminal then you can not.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top