#service #solana #airdrop #task-scheduler #logging

app solana-airdrop-service

A background service for scheduling Solana airdrops

2 releases

new 0.1.1 Feb 7, 2025
0.1.0 Feb 7, 2025

#424 in Magic Beans

Download history 167/week @ 2025-02-02

167 downloads per month

MIT license

8KB
106 lines

Solana Airdrop Service

Linux/macOS Setup

Create a Systemd Service

  1. Open a terminal and create a systemd service file:

    sudo nano /etc/systemd/system/solana-airdrop.service
    
  2. Add the following configuration:

    [Unit]
    Description=Solana Airdrop Service
    After=network.target
    
    [Service]
    ExecStart=/usr/bin/env cargo run --release
    WorkingDirectory=/path/to/solana-airdrop-service
    Restart=always
    User=your-username
    
    [Install]
    WantedBy=multi-user.target
    
  3. Reload the systemd daemon:

    sudo systemctl daemon-reload
    
  4. Enable and start the service:

    sudo systemctl enable solana-airdrop
    sudo systemctl start solana-airdrop
    
  5. Check logs:

    journalctl -u solana-airdrop -f
    
  6. Stop the service if needed:

    sudo systemctl stop solana-airdrop
    

Windows Setup

Build the Executable

cargo build --release

Add Service Using Windows Task Scheduler

  1. Press Windows + R, type taskschd.msc, and press Enter.
  2. Click "Create Basic Task".
  3. Set the name as "Solana Airdrop Service".
  4. In the "Trigger" section, choose "Daily".
  5. In the "Action" section, select "Start a program".
  6. Under "Program/script", browse and select the built solana-airdrop-service.exe file.
  7. Click "Finish".

Configure Automatic Execution Every 8 Hours

  1. Open Task Scheduler.
  2. Double-click the created task.
  3. Go to the "Triggers" tab and click "Edit".
  4. Check "Repeat task every 8 hours".

Logging

Linux/macOS

To monitor logs:

tail -f /tmp/solana_airdrop.log

If using systemd:

journalctl -u solana-airdrop -f

Windows

To view logs in Windows, open the log file:

notepad C:\tmp\solana_airdrop.log

If the C:\tmp folder does not exist, create it:

mkdir C:\tmp

Dependencies

~5–15MB
~208K SLoC