Take a look at man cron
, or other examples on the Internet. I believe that the problem you are having is you're not using the full path the the binaries.
| melon@pc ~>$ which xmodmap
/usr/bin/xmodmap
In your cron -e
, instead of xmodmap
, you would put /usr/bin/xmodmap
.
But, even with this change, you won't see any key changes.
Linux is great in that it provides various solutions to problems, but look into how others have solved similar problems. For example, xmodmap
is typically invoked in .xinitrc
, which is executed when your X session starts. xmodmap
really won't work the way you're trying, at least for your normal user.
Since you're interested in xmodmap
, I recommend you look at documentation and examples and forget about cron
completely for this current issue.
If you are unwilling to look at documentation and other examples, or want a real understanding of how things work, you can look up the man
pages:
XMODMAP(1) General Commands Manual XMODMAP(1)
NAME
xmodmap - utility for modifying keymaps and pointer button mappings in X
SYNOPSIS
xmodmap [-options ...] [filename]
DESCRIPTION
The xmodmap program is used to edit and display the keyboard modifier map and keymap table
that are used by client applications to convert event keycodes into keysyms. It is usually
run from the user's session startup script to configure the keyboard according to personal
tastes.
This last sentence has the answers to your problem.
At this point, you don't know if cron
isn't working (this is your suspicion), or if xmodmap
fired, but you don't see the effects. The latter is the likely scenario. Your user needs to execute xmodmap
within the current X session for xmodmap
changes to be effective.
Once you get xmodmap
working without cron
, you can solve the next problem. As mentioned earlier, you need full system paths, but you also need to tell cron
how to run the file. You've simply pointed to the file, which works on your terminal, as it uses the shebang/interpreter (ie: #!/bin/bash
). So, for cron
to run a bash
file...
| melon@nifflheim ~>$ which bash
/usr/bin/bash
| melon@nifflheim ~>$ crontab -e
...
@reboot /usr/bin/bash /home/user/scripts/myscript.sh
Though, do you really want root
running a script found in your user directory? With what you've learned so far, maybe you add /usr/bin/bash /home/user/scripts/myscript.sh
(or source
it) in ~/.xinitrc
instead ^_~.