Echo/kill pgrep

Hi folks. I'm wondering why the following doesn't work and hoe to fix it...

I can:

# pgrep foo
1234

I can:

# echo | pgrep foo
1234

But I can't

# kill | pgrep foo
kill: usage: blah blah

So why does echo pipe correctly but kill doesn't?

kill requires at least one argument (one or more PIDs).

kill [-s signal|-p] [-q sigval] [-a] [--] pid...

echo doesn't require any arguments (and wouldn't appear to serve any purpose in your example).

You could use kill $(pgrep foo) . Or, you could just use pkill foo instead.

The pipe symbol on the left means input.
But you want to pass the output to the kill command.
Then, the kill command works with arguments, not with an input stream. So you need the xargs program to convert the input stream to arguments.

pgrep foo | xargs kill

As mentioned, if pgrep does not find anything then kill complaints of missing arguments.
Therefore, and for the sake of simplicity:

pkill foo

ahhhh. I like pkill.

Many thanks.

Hi there.

I would like to add a mount line to a cluster of mini servers, quite a few of them. I need to do this remotely with pssh.

The problem being ssh sudo echo snd ssh sudo fprint both produce permission denied. I know sudo echo works locally, so it's quite rightly prevented over ssh. This isn't a password problem as I have copied shared keys.

So, the question is, how can I do this quite wrongly using ssh? (!)
I can only use pssh, I could use a script if I can take an ip list from file, or I could use python. I cannot add any software to the nodes. Or at least I really don't want to.

Many thanks.

------ Post updated at 07:44 PM ------

Just thought I'd try pssh <ops> "sudo chmod 0777 /etc/fstab" worked fine, then I could echo the mount line.

So, there you go!

You have made /etc/fstab world-writable and had better correct that before something else overwrites it by accident, or an attacker takes advantage of the situation! 777 is not the magic sledgehammer to fix all problems!

echo is not prevented over ssh. As you discovered, file permissions were preventing you. The correct thing to do would be to obtain the required permissions.

Hi there.

I'm currently playing around with a small cluster of mini boards running Debian. Or Raspbian to be precise. Each node is given a datafile and renders animation frames. This is as much a cluster as it c be, I'm using one as a header, I've written some scripts and code to automate certain tasks, but every node is totally isolated save it's wifi connection to the same network.

So I'm wondering what os' there are around that could use all these nodes as one. 12x4 cores could be fun to play around with, and may possibly save time as a lot of duplicated file checking would be avoided.

If I can get this working I'm prepared to sink a bit of cash into the project and add a load more nodes. So, what do you think my options would be?

Many thanks.

How about using blender to render ?
Is this perhaps what are you looking for :
Flamenco -

Creating your own distributed rendering system with multiple nodes will take a considerable effort.
Much better time spent is using existing open source solution, reporting and perhaps even fixing bugs :b:

Regards
Peasant.

Sorry, reply was meant to be a post!

------ Post updated at 02:22 PM ------

I am very much using Blender and getting good results with a small cluster. I have asked on Blender Artists if there is a way I can get some hooks/triggers into the render code and hit a bit of a brick wall. If you think you can help me through that please let me know.

What sort of hooks and triggers? What, exactly, are you attempting to do?

Running a massively parallel system over wifi sounds like a recipe for migraines -- 100baseT still beats wireless for everything hands-down.

I've belatedly realized a better answer to your earlier question than chmod 777:

ssh -t username@host 'sudo su -' <<"EOF"
echo "Literal script contents"
echo "et cetera"
EOF