This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 192942 - apmscript should use pccardctl
apmscript should use pccardctl
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: apmd (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Zdenek Prikryl
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-24 09:39 EDT by Valentin Kuznetsov
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-07 09:33:15 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Valentin Kuznetsov 2006-05-24 09:39:46 EDT
Description of problem:
As I found apmscript used cardctl to stop pcmcia sub-system. Since cardctl is 
depricated in favor of pcmciautils, the apmscripts needs to be fixed to use
pccardctl instead of cardctl.

Also I would like to request to add service to stop/restart/kill 
network-related tasks when apmd is invoked and resume them in another network 
hot-spot. For instance, I use one network in my office, when I finish I put 
laptop in sleep mode using apmd and bring it home where I have another 
network. So, all my ssh/afs/instance messaging/ntpd sessions need to be 
restarted/killed because of that.

To resolve such kind of problems I added the following
if [ "$NET_RESTART" = "yes" ] ; then
                /sbin/service afs stop
                /sbin/service ntpd stop
                /sbin/service cups stop
                /sbin/ifconfig | grep "inet addr:" | awk 
'{split($2,a,"addr:"); if(a[2]!="127.0.0.1") print a[2]}' 
> /var/run/apm-old-ip
fi

before service network stop and 

if [ "$NET_RESTART" = "yes" ] ; then
                # new local stuff, added by VK
                /sbin/ifconfig | grep "inet addr:" | awk 
'{split($2,a,"addr:"); if(a[2]!="127.0.0.1") pr
int a[2]}' > /var/run/apm-new-ip
                diff /var/run/apm-new-ip /var/run/apm-old-ip
                if [ $? != 0 ]; then
                        killall ssh
                        ps auxw|grep sshfs|grep -v grep|awk '{print 
"fusermount -u "$13""}'|/bin/sh
                fi
                rm -f /var/run/apm-new-ip /var/run/apm-old-ip
                /sbin/service afs start
                /sbin/service ntpd start
                /sbin/service cups start
fi

right after pcmcia system is resumed.

Version-Release number of selected component (if applicable):

apmd-3.2.2-3.2.i386

Thanks,
Valentin.

P.S. Here is a patch for what I described above:
--- apmscript.fc5       2006-05-24 09:32:21.000000000 -0400
+++ apmscript   2006-05-24 09:44:45.000000000 -0400
@@ -122,12 +122,17 @@
                done
        fi
        if [ "$NET_RESTART" = "yes" ] ; then
+               # stop network related services
+               /sbin/service afs stop
+               /sbin/service ntpd stop
+               /sbin/service cups stop
+               /sbin/ifconfig | grep "inet addr:" | awk 
'{split($2,a,"addr:"); if(a[2]!="127.0.0.1") print a[2]}' 
> /var/run/apm-old-ip
                /sbin/service network stop
        fi
        [ -n "$NEED_NETFS_START" ] && echo "/sbin/service netfs start" 
>>/var/run/apm-resume-post
        [ "$PCMCIARESTART" = "yes" ] && {
-               /sbin/cardctl suspend
-               /sbin/cardctl eject
+               /sbin/pccardctl suspend
+               /sbin/pccardctl eject
        }
        if [ "$PCMCIAWAIT" = "yes" ]; then
                until [ `LC_ALL=C grep "Socket .: empty" /var/lib/pcmcia/stab|
wc -l` = `LC_ALL=C grep "Socket" /var/lib/pcmcia/stab|wc -l` ]; do
@@ -260,8 +265,21 @@

        # Restore network and PCMCIA
        if [ "$PCMCIARESTART" = "yes" ] ; then
-               /sbin/cardctl insert
-               /sbin/cardctl resume
+               /sbin/pccardctl insert
+               /sbin/pccardctl resume
+       fi
+        if [ "$NET_RESTART" = "yes" ] ; then
+               # restore network related services after resuming PCMCIA
+               /sbin/ifconfig | grep "inet addr:" | awk 
'{split($2,a,"addr:"); if(a[2]!="127.0.0.1") print a[2]}' 
> /var/run/apm-new-ip
+               diff /var/run/apm-new-ip /var/run/apm-old-ip
+               if [ $? != 0 ]; then
+                       killall ssh
+                       ps auxw|grep sshfs|grep -v grep|awk '{print 
"fusermount -u "$13""}'|/bin/sh
+               fi
+               rm -f /var/run/apm-new-ip /var/run/apm-old-ip
+               /sbin/service afs start
+               /sbin/service ntpd start
+               /sbin/service cups start
        fi

        [ "$NETFS_RESTART" = "yes" ] && /etc/rc.d/init.d/netfs start
Comment 1 Zdenek Prikryl 2007-08-21 04:43:19 EDT
Hello,
FC5 has now been EOL'd. But as I found, cardclt is still used in apm script. So
this problem will be fixed soon.

But for restarting services is in apm.conf parameter. RESTORESERVICES defines
what services will be restarted after resume. I thing it is sufficient for your
problem, isn't it?

Zdenek

Note You need to log in before you can comment on or make changes to this bug.