Do you want to claim rewards for a steem account automatically twice a day? When:
- you use a linux system with python and systemctl
- have beem installed
- a wallet created (
beempy createwallet --wipe) - and a posting key stored (
beempy addkey)
then you can follow this tutorial to add a systemd timer for claiming rewards.
Warning
Installing a timer for claiming rewards twice a day is convenient, but involves some risks. We are storing the posting key of an account on a (remote) server. Everyone that manages it to log in as root on the server will be able to receive the posting key. (The wallet password is stored in the script. After copying the wallet-sql library, the attacker can decrypt the stored posting key with the wallet password.)
Never store an owner key or a master key in a beem wallet!
Knowing this, it is advised to immediately change the posting key, when something unusual happens.
At first we need three files:
- steem-claimreward.timer
[Unit]
Description=Claim rewards twice daily
[Timer]
OnCalendar=*-*-* 00,12:00:00
RandomizedDelaySec=43200
Persistent=true
[Install]
WantedBy=timers.target
- steem-claimreward.service
[Unit]
Description=Claim reward service
After=syslog.target
[Service]
Type=oneshot
User=root
Group=root
ExecStart=/root/claimreward.sh
SyslogIdentifier=steem-claimreward
StandardOutput=syslog
StandardError=syslog
- claimreward.sh
#!/bin/bash
beempy updatenodes
export UNLOCK='Your-Wallet-Password'
beempy claimreward yoursteemacc
We store steem-claimreward.timer and steem-claimreward.service in /etc/systemd/system.
cp steem-claimreward.* /etc/systemd/system
The bash script is moved to /root. In order to increase security, we assure that only root can read this file:
chmod 700 /root/claimreward.sh
It is also possible to replace the root user by another user in the steem-claimreward.service. The claimreward.sh has than to moved to a place the user can access.
Now, replace yoursteemacc with the account name from which you want to claim (posting key of this account has to be stored into the beempy wallet). Then you have to replace Your-Wallet-Password with your beempy wallet password.
Activate the timer
systemctl reenable --now steem-claimreward.timer
activates the timer. With
systemctl list-timers
or
systemctl status steem-claimreward.timer
you can check for the next execution time point.
The log file can be viewed by:
journalctl -f -u steem-claimreward
Controlling the timer
- enable
systemctl enable steem-claimreward.timer
- disable
systemctl disable steem-claimreward.timer
- start
systemctl start steem-claimreward.timer
- stop
systemctl stop steem-claimreward.timer
Is systemctl service better than cron job?
I find yes, a systemctl timer can be started and stopped. I can see the next execution time and I can easily use journalctl for viewing the log.
Feels a bit too much "root" for its own good. Would be cool if this would be possible as non root user, like with cron jobs.
I updated my post.
It is possible to add
User=user_xyz Group=user_xyzin
steem-claimreward.service.Control of steem-claimreward can be allowed for
user_xyzby adding it to the sudoers file.Hi @holger80! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus and want to thank you for delegating SP to us in this early stage!
Wow! I never thought that it is possible to use
systemctlservice the same way as cron job. 👍Congratulations @holger80! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOPDo not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.