Discussion:
run fuse failed by systemctl
(too old to reply)
Anudorannador
2017-06-23 03:21:15 UTC
Permalink
Hi !
I wrote a program, and there is a pice of the code:
```
char *fa[] = { "-f", "-odefault_permissions", "-oallow_other", NULL};

struct fuse_args fuse_args = FUSE_ARGS_INIT(sizeof
(fa)/sizeof(gpointer) - 1, fa);

struct fuse_chan *fuse_chan = fuse_mount(CFSDIR, &fuse_args);
if (!fuse_chan) {
fprintf("fuse_mount error: %s", strerror(errno));
exit(-1);
}

if (!(fuse = fuse_new(fuse_chan, &fuse_args, &fuse_ops,
sizeof(fuse_ops), NULL))) {
fprintf("fuse_new error: %s", strerror(errno));
exit(-1);
}

fuse_set_signal_handlers(fuse_get_session(fuse));
...
while(1){ ... }
```
When I run the program by cmd, that is:
# ./myprog
It works well. CFSDIR, which is a macro of '/etc/xxx', is mounted:
# df -h | grep /etc/xxx
# /dev/fuse 30M 12K 30M 1% /etc/xxx
The question is when I use systemd to start it :
# systemctl start myprog.service
it seems fine, no error but dirctory /etc/xxx not be mounted.
And catch nothing with command `df -h | grep /etc/xxx`

Here is my service:
```
[Unit]
Description=xxx
ConditionPathIsMountPoint=!/etc/xxx
After=network.service

[Service]
Type=simple
ExecStart=/usr/bin/myprog
PrivateTmp=true

[Install]
WantedBy=multi-user.target
```

Could you please help me ? Thanks.

Loading...