What does the output of crontab -l
on your device look like?
It should be something like this:
root@xxxxxx:~# crontab -l
*/1 * * * * scp /tmp/dhcp.leases root@yyyyyyy:/tmp/dhcp.leases
What does the output of crontab -l
on your device look like?
It should be something like this:
root@xxxxxx:~# crontab -l
*/1 * * * * scp /tmp/dhcp.leases root@yyyyyyy:/tmp/dhcp.leases
looks exactly like yours except /5 instead of /1
root@XXX:~# crontab -l
*/5 * * * * scp /tmp/dhcp.leases root@IP_AP1:/tmp/dhcp.leases
*/5 * * * * scp /tmp/dhcp.leases root@IP_AP2:/tmp/dhcp.leases
and as said previously everything works (copy is updated every 5mn) but with a logged cron.err message
If you want to suppress these messages:
uci set system.@system[0].cronloglevel='9'
uci commit system
/etc/init.d/cron restart
I cannot tell this from the crond log message alone, but since it works fine, I would guess there was no error.
OK THX I'll stay like it is by default to level 5
as moving to cronloglevel=9 well modifies the reporting level with no report of the cron start nor of the scp copies every 5 mn. But it also donnot report of true errors (I introduced a wrong line in the crontab for testing and it was not detected)
This post gives an explanation at the end
BR
Wow, working great!
Should add the same command on startup also?
Maybe cron job is executing the code also on startup?
Thanks @pkmann !! Learned something new and improved user experience on access points
@66enligne same cron reports err even if command executed successfully. looks like its done to save memory Cron.err - why? - #5 by biangbiangmian
This may help as well:
Any chance this can be made into a package or added to Luci by default for all those folks to like to manage their devices from within Luci?
I'm having trouble making the directory.
It won't create the folder because a file exists, but no file exists?
root@rp4-openwrt:/# mkdir ~/.ssh/
mkdir: can't create directory '/root/.ssh/': File exists
root@rp4-openwrt:/# ls
bin dev lib lost+found overlay rom sbin tmp var
boot etc lib64 mnt proc root sys usr www
root@rp4-openwrt:/# mkdir ~/.ssh/
mkdir: can't create directory '/root/.ssh/': File exists
root@rp4-openwrt:/# cd /.ssh/
-ash: cd: can't cd to /.ssh/: No such file or directory
Edit
It has created a new folder /root/.ssh
is that the correct folder structure or should it be /.ssh/
?
Edit 2
I've got it working. Thanks for adding those tips.
How to do this from command line?
Your answer is contained within the quote. What issue are you experiencing?
Post # one.
I thought this was about generating SSH keys, not adding a public key on the secondary device.
And?
dropbearkey
Usage: dropbearkey -t <type> -f <filename> [-s bits]
-t type Type of key to generate. One of:
rsa
ed25519
-f filename Use filename for the secret key.
~/.ssh/id_dropbear is recommended for client keys.
-s bits Key size in bits, should be a multiple of 8 (optional)
Ed25519 has a fixed size of 256 bits
-y Just print the publickey and fingerprint for the
private key in <filename>.
dropbearkey ssh-keygen -t rsa -f ~/.ssh/id_dropbear`
root@OpenWrt:~# ssh-keygen -t rsa -f ~/.ssh/id_dropbear
-ash: ssh-keygen: not found
I think you don't understand my question.
I want to paste SSH key using command line and not in Luci.
Yep. You need to add it. Or just use the dropbearkey
stanza if you want to replicate the OP’s method. Generating public and private keys
can you show me?