Re: [systemd-devel] systemctl enable myunit.service ---> Failed to execute operation: Invalid argument

2015-12-29 Thread bobafetthotmail

Finally found a workaround, bypassing systemctl.

I'm making myself (having the script autoinstall routine do, actually) 
the symlink that systemctl refuses to make, as that's the only thing 
that "systemctl enable XXX.service" seems to do.


ln -s /etc/folder2ram/folder2ram.service 
/lib/systemd/system/local-fs.target.wants/folder2ram.service


(from the service file wherever it is, to the folder of the target 
stated in "WantedBy=foo-bar.target" in the install section)


Ran some tests, and my script is indeed called on startup and shutdown, 
no error reported anywhere.


So this issue was confined to systemctl (thankfully).

-Albert


On 12/28/2015 04:21 PM, bobafetthotmail wrote:


On 12/28/2015 04:55 AM, Andrei Borzenkov wrote:

27.12.2015 22:23, bobafetthotmail пишет:

I'm still trying to understand why my unit (see the quote below) that
calls a script can be started/stopped but cannot be enabled..

I tried changing everything in the unit, it still fails any help?

I googled and the only thing I found is a guy having a similar 
problem here

http://ubuntuforums.org/showthread.php?t=2287364
but none answered him and he had to fall back to add a line to the
/etc/rc.local


Do you have any initscript with the same name (I do not know where they
are located in Debian)?


No, I have no initscript with the same name.

On Debian they are located in /etc/init.d

Thanks.

-Albert



-Albert


On 12/13/2015 07:09 PM, bobafetthotmail wrote:

Hi, it's me again. :)

I made a systemd unit called "folder2ram.service", with these 
contents:


--
[Unit]
Description=folder2ram systemd service

[Service]
Type=oneshot
ExecStart=/sbin/folder2ram -mountall
ExecStop=/sbin/folder2ram -umountall
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
-

/sbin/folder2ram is a shell script, that is, its shebang is #! /bin/sh

If I place the systemd unit in either /lib/systemd/system/ or
/etc/systemd/system/

when I write: "systemctl enable folder2ram"

It returns:

Failed to execute operation: Invalid argument


But I can start or stop it normally with "systemctl start/stop
folder2ram".

This is the output of "systemctl status folder2ram" when stopped:
-
  folder2ram.service - folder2ram systemd service
Loaded: loaded (/lib/systemd/system/folder2ram.service; disabled)
Active: inactive (dead)
-

This is the output when started:
-
  folder2ram.service - folder2ram systemd service
Loaded: loaded (/lib/systemd/system/folder2ram.service; disabled)
Active: active (exited) since Sun 2015-12-13 18:54:16 CET; 1min 
4s ago

   Process: 21257 ExecStart=/sbin/folder2ram -mountall (code=exited,
status=0/SUCCESS)
  Main PID: 21257 (code=exited, status=0/SUCCESS)

Dec 13 18:54:16 alby-xeon folder2ram[21257]: will now start all
mountpoints
-

I'm on Debian Jessie, using Systemd 215 (the normal Debian Jessie 
one).


Can someone give me some hints to understand what I'm doing wrong?

Also, could it be possible to have more verbose error text?

Where and/or what is the invalid argument?

Thanks

-Albert
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Query regarding "EnvironmentFile"

2015-12-29 Thread Reindl Harald



Am 26.12.2015 um 20:39 schrieb Manuel Amador (Rudd-O):

On 12/26/2015 07:28 PM, Reindl Harald wrote:


my infrastructure is most likely better managed than anyone leses


So says the person with a limited perspective and a refusal to learn
modern tools and processes


the person with a limited perspective yet converted cronjobs using a 
sourced shell script for a update-system where base locations for every 
server are defined by sourcing a shellscript just defining env-vars


that's part of a complex deplyoment and maintainance infrastrcuture for 
some hundret webhosts on a dozen of servers


guess what: EnvironmentFile can reuse that file which needs still to be 
there for configure a ton of CLI scripts for different tasks


reason for the change to a oneshot-systemd unit?
to restrict capabilities and write/read permissions more

there is a world outside "the daemon" at all1

EnvironmentFile=/scripts/cl-update-service.inc.sh
Type=oneshot
ExecStart=/path/to/cronscript
User=wwwcron
Group=apache
PrivateTmp=yes
PrivateDevices=yes
NoNewPrivileges=yes
CapabilityBoundingSet=CAP_KILL CAP_CHMOD CAP_FOWNER
ReadOnlyDirectories=/etc
ReadOnlyDirectories=/usr
ReadOnlyDirectories=/var/lib
ReadOnlyDirectories=/proc
ReadOnlyDirectories=/sys
InaccessibleDirectories=-/boot
InaccessibleDirectories=-/home
InaccessibleDirectories=-/media
InaccessibleDirectories=-/root
InaccessibleDirectories=-/etc/dbus-1
InaccessibleDirectories=-/etc/modprobe.d
InaccessibleDirectories=-/etc/modules-load.d
InaccessibleDirectories=-/etc/postfix
InaccessibleDirectories=-/etc/ssh
InaccessibleDirectories=-/etc/sysctl.d
InaccessibleDirectories=-/run/console
InaccessibleDirectories=-/run/dbus
InaccessibleDirectories=-/run/lock
InaccessibleDirectories=-/run/mount
InaccessibleDirectories=-/run/systemd/generator
InaccessibleDirectories=-/run/systemd/system
InaccessibleDirectories=-/run/systemd/users
InaccessibleDirectories=-/run/udev
InaccessibleDirectories=-/run/user



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] "StandardOutput=console" don't work as expected

2015-12-29 Thread Reindl Harald
why is there only logging instead "TEST" written to the terminal 
starting a oneshot-service or in case it's a entry in /etc/crontab 
triggering a cronmail becaus the output?


that's not helpful when try to migrate cronjobs to systemd-units for 
using ReadOnlyDirectory and other security otpions


[Service]
Type=oneshot
ExecStart=/usr/bin/echo TEST
StandardOutput=syslog+console
StandardError=inherit
__

[root@srv-rhsoft:~]$ > messages
[root@srv-rhsoft:~]$ cat messages
[root@srv-rhsoft:~]$ systemctl start contentlounge-podcast.service
[root@srv-rhsoft:~]$ cat messages
Dec 30 01:25:52 srv-rhsoft systemd: Starting ContentLounge Podcast 
Cronjob...

Dec 30 01:25:53 srv-rhsoft echo: TEST
Dec 30 01:25:53 srv-rhsoft systemd: Started ContentLounge Podcast Cronjob.
[root@srv-rhsoft:~]$



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] "StandardOutput=console" don't work as expected

2015-12-29 Thread Reindl Harald
fine, on a real TTY (CTRL+ALT+F2) the echo appears (cluttered with echo 
and the PID instead just the output) but that don't help much in a 
SSH-Session..


Am 30.12.2015 um 01:26 schrieb Reindl Harald:

why is there only logging instead "TEST" written to the terminal
starting a oneshot-service or in case it's a entry in /etc/crontab
triggering a cronmail becaus the output?

that's not helpful when try to migrate cronjobs to systemd-units for
using ReadOnlyDirectory and other security otpions

[Service]
Type=oneshot
ExecStart=/usr/bin/echo TEST
StandardOutput=syslog+console
StandardError=inherit
__

[root@srv-rhsoft:~]$ > messages
[root@srv-rhsoft:~]$ cat messages
[root@srv-rhsoft:~]$ systemctl start contentlounge-podcast.service
[root@srv-rhsoft:~]$ cat messages
Dec 30 01:25:52 srv-rhsoft systemd: Starting ContentLounge Podcast
Cronjob...
Dec 30 01:25:53 srv-rhsoft echo: TEST
Dec 30 01:25:53 srv-rhsoft systemd: Started ContentLounge Podcast Cronjob.
[root@srv-rhsoft:~]$




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemctl enable myunit.service ---> Failed to execute operation: Invalid argument (bobafetthotmail)

2015-12-29 Thread Chaiken, Alison

bobafetthotmail  writes:

Finally found a workaround, bypassing systemctl.


[ . . . ]


ln -s /etc/folder2ram/folder2ram.service
/lib/systemd/system/local-fs.target.wants/folder2ram.service


[ . . . ]


On 12/13/2015 07:09 PM, bobafetthotmail wrote: Hi, it's me again. :)

I made a systemd unit called "folder2ram.service", with these
contents:

--
[Unit]
Description=folder2ram systemd service

[Service]
Type=oneshot
ExecStart=/sbin/folder2ram -mountall
ExecStop=/sbin/folder2ram -umountall
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


I'm curious: did you try

   WantedBy=local-fs.target

in your unit file rather than multi-user.target?   Once you've created 
the symlink by hand, does 'systemctl disable' then work?


FWIW, I've had no problem creating my own unit files and enabling them 
on Jessie.


Best wishes,
Alison

---
Alison Chaiken  ali...@she-devel.com, 650-279-5600
http://{ she-devel.com, exerciseforthereader.org }
"Democracy is the original crowd-sourcing." -- Philip Tetlock,
_Superforecasting_
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] "StandardOutput=console" don't work as expected

2015-12-29 Thread Andrei Borzenkov
30.12.2015 03:40, Reindl Harald пишет:
> fine, on a real TTY (CTRL+ALT+F2) the echo appears

It is not echo, it is "+console" part of StandardOutput - i.e. it is
still logging, not output.

> (cluttered with echo
> and the PID instead just the output) but that don't help much in a
> SSH-Session..
> 
> Am 30.12.2015 um 01:26 schrieb Reindl Harald:
>> why is there only logging instead "TEST" written to the terminal
>> starting a oneshot-service or in case it's a entry in /etc/crontab
>> triggering a cronmail becaus the output?
>>
>> that's not helpful when try to migrate cronjobs to systemd-units for
>> using ReadOnlyDirectory and other security otpions
>>
>> [Service]
>> Type=oneshot
>> ExecStart=/usr/bin/echo TEST
>> StandardOutput=syslog+console
>> StandardError=inherit
>> __
>>
>> [root@srv-rhsoft:~]$ > messages
>> [root@srv-rhsoft:~]$ cat messages
>> [root@srv-rhsoft:~]$ systemctl start contentlounge-podcast.service
>> [root@srv-rhsoft:~]$ cat messages
>> Dec 30 01:25:52 srv-rhsoft systemd: Starting ContentLounge Podcast
>> Cronjob...
>> Dec 30 01:25:53 srv-rhsoft echo: TEST
>> Dec 30 01:25:53 srv-rhsoft systemd: Started ContentLounge Podcast
>> Cronjob.
>> [root@srv-rhsoft:~]$
> 
> 
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel