Crontab: usage error (what did i forget?)

so i set up this crontab

0,10,20,30,40,50 * * * * `bash /home/_40476/APPS/cmd/QOL-usr_40476/`

it auto changes my them based on the time of day, but this happens when i run crontab -T

crontab: usage error: file name or - (for stdin) must be specified

I have also tried an empty crontab but it still outputs the same error when i run crontab -T

The quotes (around the command) look wrong.

so when i try

0,10,20,30,40,50 * * * * 'bash /home/_40476/APPS/cmd/QOL-usr_40476/'

I still get the same error

crontab: usage error: file name or - (for stdin) must be specified

Why those quotes? What are you trying to hide for the shell?

And what is that ?

And you should of course always post thing as complete as possible. In this case

crontab -l

and not only what you assume that is important.

To run a bash script every 15 minutes, I used this site which created a cron line for me:

It works perfectly.
Maybe this can help since it’s different from your crontab line.

Might try

0,10,20,30,40,50 * * * * /bin/bash -c '/home/_40476/APPS/cmd/QOL-usr_40476/'


*/10 * * * * bash /home/_40476/APPS/cmd/QOL-usr_40476/ >/dev/null 2>&1

to have no output from script execution

thank you, but i am still getting

crontab: usage error: file name or - (for stdin) must be specified

here is my entire crontab file
(as of this post)
(may need to scroll down)

# Edit this file to introduce tasks to be run by cron.
# get help here
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# For more information see the manual pages of crontab(5) and cron(8)
# m h dom mon dow   command

# set theme colors
*/10 * * * * /home/_40476/APPS/cmd/QOL-usr_40476/ >/dev/null 2>&1

That’s wrong. See my previous reply, again.

ok, so just tried that, but I am still geting the same error
I even tried a completely blank cronfile but it still outputs

_40476@localhost:~> crontab -T
crontab: usage error: file name or - (for stdin) must be specified

Did you actually read what the crontab -T option is for? You need to specify the file you want to test…

ich@laptop:~> crontab -T
crontab: usage error: file name or - (for stdin) must be specified
 crontab [options] file
 crontab [options]
 crontab -n [hostname]

 -u <user>  define user
 -e         edit user's crontab
 -l         list user's crontab
 -r         delete user's crontab
 -i         prompt before deleting
 -n <host>  set host in cluster to run users' crontabs
 -c         get host in cluster to run users' crontabs
 -T <file>  test a crontab file syntax
 -s         selinux context
 -V         print version and exit
 -x <mask>  enable debugging

Default operation is replace, per 1003.2
ich@laptop:~> crontab -l

welp, thats probably my issue, I though maybe that was related to the fact the my bash script wont execute from cron, here is the code

if [ `date +%k` -gt 17 ]; then
  plasma-apply-colorscheme BreezeDark;
  plasma-apply-colorscheme BreezeClassic;

A script (I assume thatthis is meant to be a script) shoul always start with the “shebang”. The fisrt line should be:

#! /usr/bin/bash

Next is that /home/_40476/APPS/cmd/QOL-usr_40476/ should have execute permission for the user:

chmod u+x /home/_40476/APPS/cmd/QOL-usr_40476/

And then your ceontab entry

*/10 * * * * /home/_40476/APPS/cmd/QOL-usr_40476/ >/dev/null 2>&1

should just “work”


And please, please, please, always include the command you use with the ouput you show. It is only one line more at the beginning. Not very difficult I assume.


boven:~ # crontab -l
*/5 * * * *     /root/bin/nachtstop

*/5 * * * *     /root/bin/wij
boven:~ # 

I have another remark. Unitil now I did not look at what you want to do, but it looks as if you want to change something at a desktop session that is running at that moment in time.

When that is true, then please understand that it probably won’t work. The Plasma software that is running (when there is some) will probably not notice that you changed a KDE configuration because your cron job is running in the background. Maybe a fresh login of the user in Plasma will see it, but I assume you want to influence a running session.

Unix/Linux has many possibilities. There are a lot of “habits” and the like around that one does not must follow, but deviating makes it more problematic for others to understand what your goal is.

One such “habit” is that directories inside /home are the home directories of users. Do we have to understand that _40476 is a user? And can we be sure that _40476 is making this crontab entry? And the user _40476 thus is the owner of all directories in the path to and also of the file _40476/APPS/cmd/QOL-usr_40476/ ? And that user _40476 is the user that runs the Plams session?

Hi, also look at using a user systemd service and timer… cron is old school…deprecated…

ok, so i added a notification feature to see if it was triggering and it is working, so now i just have to wait until my theme changes

update : it only worked once and then stopped

Hypothesis : the dark mode is borked

#! /usr/bin/bash
if [ `date +%k` -gt 16 ]; then
  plasma-apply-colorscheme BreezeDark;
  notify-send 'theme changed to BreezeDark' -t 3000 -i window -a 'Theme changer'
  plasma-apply-colorscheme BreezeClassic;
  notify-send 'theme changed to BreezeClassic' -t 3000 -i window -a 'Theme changer'