Regex match not working

25 views
Skip to first unread message

Joao Santos

unread,
Nov 6, 2012, 2:09:54 PM11/6/12
to help-c...@googlegroups.com
I'm trying to force a system to have only one getty, on tty1, but i'm hitting some road blocks.
This is the promise right now:

  processes:
    "getty (/dev/tty[2-9])"
      process_stop => "/sbin/initctl stop tty TTY=$(match.1)",
      comment => "Process getty $(match.1) should be stopped";

The problem is that initctl is being called with the text "$(match.1)" instead of, for example, "/dev/tty5". The getty HAS to be stopped with this command, killing it will only get it restarted by the init system.

Any ideas?

neilhwatson

unread,
Nov 6, 2012, 2:28:48 PM11/6/12
to help-c...@googlegroups.com
I see the same problem with 3.3.5.  Even match.0 is not expanded.  Yet, there are matched indicated in verbose mode.

cf3> Observe process table with /bin/ps -eo user,pid,ppid,pgid,pcpu,pmem,vsz,pri,rss,nlwp,stime,time,args
cf3>
cf3>     .........................................................
cf3>     Promise's handle:
cf3>     Promise made by: "getty (tty[2-9])"
cf3>     .........................................................
cf3>
cf3>  ->  Found matching pid 10742
     (root     10742     1 10742  0.0  0.0   3796  22   472    1 Oct16 00:00:00 /sbin/mingetty tty2)
cf3>  ->  Found matching pid 10743
     (root     10743     1 10743  0.0  0.0   3796  21   476    1 Oct16 00:00:00 /sbin/mingetty tty3)
cf3>  ->  Found matching pid 10752
     (root     10752     1 10752  0.0  0.0   3796  21   476    1 Oct16 00:00:00 /sbin/mingetty tty4)
cf3>  ->  Found matching pid 10754
     (root     10754     1 10754  0.0  0.0   3796  21   472    1 Oct16 00:00:00 /sbin/mingetty tty5)
cf3>  ->  Found matching pid 10756
     (root     10756     1 10756  0.0  0.0   3796  17   472    1 Oct16 00:00:00 /sbin/mingetty tty6)
stop tty TTY=${match.1}

Joao Santos

unread,
Nov 6, 2012, 2:39:37 PM11/6/12
to help-c...@googlegroups.com
You used curly braces. Shouldn't they be parenthesis ?

stop tty TTY=${match.1}

neilhwatson

unread,
Nov 6, 2012, 2:47:27 PM11/6/12
to help-c...@googlegroups.com
{} and () are inter-changable.

Reply all
Reply to author
Forward
0 new messages