Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Systemd custom startups


    Hello linux users. I've been searching and experimenting with this problem for some time now. I'm trying to run custom scripts on startup in systemd. Currently I'm attempting to run a macchanging script. Here's the systemd service file I created in /etc/systemd/system called macspoof@wlan0.service:

    Code:
    [Unit]
    Description=MAC address change %I
    Before=dhcpcd@%i.service
    
    [Service]
    Type=oneshot
    ExecStart=/sbin/ifconfig wlan0 down
    ExecStart=/bin/bash /home/user/code/sh/ranmac.sh
    
    [Install]
    WantedBy=network.target
    But I've also tried this:
    Code:
    [Unit]
    Description=MAC address change %I
    Before=dhcpcd@%i.service
    
    [Service]
    Type=oneshot
    ExecStart=/sbin/ifconfig wlan0 down
    ExecStart=/usr/bin/macchanger -r wlan0
    
    [Install]
    WantedBy=network.target
    The first one is the path to my script which runs the above commands and then prints a confirm in bash. No matter what I do(and I've tried this with other scripts and things as well) I can't get anything custom to run at startup in systemd.

    Any help would be appreciated thanks.

  2. #2
    Did you use systemctl to see if it was enabled? If not, you can check with systemctl is-enabled [service]. If systemctl isn't installed, have you tried adding it to the "daemons" array in rc.conf?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •