I just tested this and it works fine.  Maybe your problem is that you
have your bootscript path set to "/usr/bin/local/" (which doesn't exist
by default) when you meant "/usr/local/bin" (which does exist)?

In any case this seems invalid.

** Changed in: systemd (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1841928

Title:
  systemd  service file not triggering the bash script

Status in systemd package in Ubuntu:
  Invalid

Bug description:
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=16.04
  DISTRIB_CODENAME=xenial
  DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"

  systemd:
    Installed: 229-4ubuntu21.21
    Candidate: 229-4ubuntu21.22
    Version table:
       229-4ubuntu21.22 500
          500 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu 
xenial-updates/main amd64 Packages
   *** 229-4ubuntu21.21 500
          500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 
Packages
          100 /var/lib/dpkg/status
       229-4ubuntu4 500
          500 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial/main 
amd64 Packages

  Computer type: AWS EC2 instance

  I am creating a systemd service file like this:

  ######################################################################
  bootscript=/usr/bin/local/luksautomount.sh
  servicename=luksautomount

  cat > $bootscript <<EOF
  #!/usr/bin/env bash
  echo "$bootscript ran at $(date)!" >> /tmp/it-works
  EOF

  chmod +x $bootscript

  cat > /etc/systemd/system/$servicename.service <<EOF
  [Service]
  ExecStart=$bootscript
  [Install]
  WantedBy=default.target
  EOF
  ######################################################################

  After successful creation of the service file and bash script that is
  triggered with the service file, I am testing the service file with:

  
  systemctl start $servicename

  Syslog shows that service has been started, but the "/tmp/it-works" is
  never created nor the line appended to an existing file.

  ######################################################################
  Aug 29 11:11:02 ip-10-124-0-64 systemd[1]: Started customboot.service.
  ######################################################################

  
  If I rename the service file to anything else that "luksautomount", the 
service is started, the bash script executed and the line is appended to the 
"/tmp/it-works" file.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1841928/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to