I found my google compute instance in terminated state - google-compute-engine

I found this lines in /var/log/auth.log ( Ubuntu 15.04 )
Aug 6 20:46:52 <> systemd-logind[641]: Power key pressed.
Aug 6 20:46:52 <> systemd-logind[641]: Powering Off...
Aug 6 20:46:52 <> systemd-logind[641]: System is powering down.
Aug 6 20:46:53 <> sshguard[1440]: Got exit signal, flushing blocked addresses and exiting...
Aug 6 20:46:53 <> sshd[1419]: Received signal 15; terminating.
What does it mean? Who or what turn off my instance?

Related

DRBD/Pacemaker/Corosync both node error sync, Missing resource when Clone Node

missing resource group when clone node, i see noti below.
Failed Resource Actions:
DrbdData_monitor_60000 on node3.cacticluster 'master' (8): call=74, status=complete, exitreason='',
last-rc-change='Wed Feb 1 22:31:53 2023', queued=0ms, exec=0ms
DRBD Status in connecting.... state
I tried several ways but no success, these 2 node clusters are cloned by me, any solution, thanks a lot!
Log Drbd messages
Feb 7 19:11:47 node4 kernel: drbd cacti: conn( WFConnection -> WFReportParams )
Feb 7 19:11:47 node4 kernel: drbd cacti: Starting ack_recv thread (from drbd_r_cacti [29736])
Feb 7 19:11:47 node4 kernel: block drbd0: drbd_sync_handshake:
Feb 7 19:11:47 node4 kernel: block drbd0: self FD6598A8213A2C93:600465D29E804184:077527C5351B305A:077427C5351B305A bits:339 flags:0
Feb 7 19:11:47 node4 kernel: block drbd0: peer 1C4C9191DB7E2555:600465D29E804185:077527C5351B305A:077427C5351B305A bits:164 flags:0
Feb 7 19:11:47 node4 kernel: block drbd0: uuid_compare()=100 by rule 90
Feb 7 19:11:47 node4 kernel: block drbd0: helper command: /sbin/drbdadm initial-split-brain minor-0
Feb 7 19:11:48 node4 kernel: block drbd0: helper command: /sbin/drbdadm initial-split-brain minor-0 exit code 0 (0x0)
Feb 7 19:11:48 node4 kernel: block drbd0: Split-Brain detected but unresolved, dropping connection!
Feb 7 19:11:48 node4 kernel: block drbd0: helper command: /sbin/drbdadm split-brain minor-0
Feb 7 19:11:48 node4 kernel: block drbd0: helper command: /sbin/drbdadm split-brain minor-0 exit code 0 (0x0)
Feb 7 19:11:48 node4 kernel: drbd cacti: conn( WFReportParams -> Disconnecting )
Feb 7 19:11:48 node4 kernel: drbd cacti: error receiving ReportState, e: -5 l: 0!
Feb 7 19:11:48 node4 kernel: drbd cacti: ack_receiver terminated
Feb 7 19:11:48 node4 kernel: drbd cacti: Terminating drbd_a_cacti
Feb 7 19:11:48 node4 kernel: drbd cacti: Connection closed
Feb 7 19:11:48 node4 kernel: drbd cacti: conn( Disconnecting -> StandAlone )
Feb 7 19:11:48 node4 kernel: drbd cacti: receiver terminated
Feb 7 19:11:48 node4 kernel: drbd cacti: Terminating drbd_r_cacti
Feb 7 19:11:48 node4 crmd[1459]: notice: Initiating stop operation DrbdFS_stop_0 locally on node4.cacticluster
Feb 7 19:11:48 node4 crmd[1459]: notice: Initiating stop operation DrbdFS_stop_0 on node3.cacticluster
Feb 7 19:11:48 node4 Filesystem(DrbdFS)[45317]: INFO: Running stop for /dev/drbd0 on /mnt/DATA
Feb 7 19:11:48 node4 Filesystem(DrbdFS)[45317]: INFO: Trying to unmount /mnt/DATA
Feb 7 19:11:48 node4 Filesystem(DrbdFS)[45317]: INFO: unmounted /mnt/DATA successfully
Feb 7 19:11:48 node4 crmd[1459]: notice: Result of stop operation for DrbdFS on node4.cacticluster: 0 (ok)
Feb 7 19:11:49 node4 crmd[1459]: notice: Initiating start operation DrbdFS_start_0 on node3.cacticluster
Feb 7 19:11:49 node4 crmd[1459]: notice: Initiating demote operation DrbdData_demote_0 locally on node4.cacticluster
Feb 7 19:11:50 node4 kernel: block drbd0: role( Primary -> Secondary )
Feb 7 19:11:50 node4 kernel: block drbd0: 1356 KB (339 bits) marked out-of-sync by on disk bit-map.

Unable to match an mysql string response in freeradius

I using freeradius 2.2.8 and mysql for sending our coa/disconnect messages via freeradius when a bandwidth quota is hit. That part of the code is working great. Unfortunately for me the coa/disconnect message is sent out even though an Accounting Stop is sent out by the NAS. In order to prevent that from happening I am putting a condition where in I pull the acct termination cause from mysql radacct table and compare it against some strings.
Under accounting,
update control {
....
Tmp-String-0 := "%{sql:SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='%{User-Name}' AND radacct.acctsessionid='%{Acct-Session-Id}'}}"
***if ("%{control:Tmp-String-0}" != "User-Request")***{
if (("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-2}") || ("%{control:Tmp-Integer-1}" > "%{control:Tmp-Integer-3}")){
if ("%{control:coa_dm}" == "coa"){
update coa {
User-Name = "%{User-Name}"
Acct-Session-Id = "%{Acct-Session-Id}"
NAS-IP-Address = "%{NAS-IP-Address}"
#Filter-Id = "UN-AUTHORIZED-PROFILE"
Framed-IP-Address = "%{Framed-IP-Address}"
Session-Timeout = 10
}
}
if ("%{control:coa_dm}" == "dm"){
update disconnect {
User-Name = "%{User-Name}"
NAS-IP-Address = "%{NAS-IP-Address}"
}
}
}
}
As per the freeradius debug logs we can see that the string should be a match and the program should avoid the inside if conditions. Unfortunately that is not the case and the 1st IF condition always returns true.
***Thu May 17 17:43:41 2018 : Info: expand: SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='%{User-Name}' AND radacct.acctsessionid='%{Acct-Session-Id}' -> SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='kiranc' AND radacct.acctsessionid='5AFD71CB-3FE1C000'
Thu May 17 17:43:41 2018 : Debug: rlm_sql (sql): Reserving sql socket id: 16
Thu May 17 17:43:41 2018 : Info: sql_xlat finished
Thu May 17 17:43:41 2018 : Debug: rlm_sql (sql): Released sql socket id: 16
Thu May 17 17:43:41 2018 : Info: expand: %{sql:SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='%{User-Name}' AND radacct.acctsessionid='%{Acct-Session-Id}'}} -> User-Request}
Thu May 17 17:43:41 2018 : Info: ++} # update control = noop
Thu May 17 17:43:41 2018 : Info: ++? if ("%{control:Tmp-String-0}" != "User-Request")
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-String-0} -> User-Request}
Thu May 17 17:43:41 2018 : Info: ? Evaluating ("%{control:Tmp-String-0}" != "User-Request") -> TRUE***
Thu May 17 17:43:41 2018 : Info: ++? if ("%{control:Tmp-String-0}" != "User-Request") -> TRUE
Thu May 17 17:43:41 2018 : Info: ++if ("%{control:Tmp-String-0}" != "User-Request") {
Thu May 17 17:43:41 2018 : Info: +++? if (("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-2}") || ("%{control:Tmp-Integer-1}" > "%{control:Tmp-Integer-3}"))
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-0} -> 3169
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-2} -> 25000000
Thu May 17 17:43:41 2018 : Info: ?? Evaluating ("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-2}") -> FALSE
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-1} -> 13402
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-3} -> 50000000
I tried the single quotes, double quotes using the & instead of %, but to no avail. The other conditions are met correctly when hit as they are returned as integers.
Thank you for the help.
I forgot to mention that I had got it working. Instead of comparing using Tmp-String-0 variable I just used the actual radius attribute name and got it working.
if (("%{Acct-Terminate-Cause}" != "User-Request")
Thank you for the help.

Moving Prestashop 1.5.6 website from one hosting account to another from the same company now consumes over 25% of the server resources?

I had a Prestashop 1.5.6 website working fine in one hosting account. After moving it to another of supposedly the same features, I started to receive warning it consumes over 25% of the server resources. I know the new account has a different mysql version, I dont know if the problem could be related to that.
The warning messages I got from the hosting provider are
CPU_TIME:606 table_rows_read:357770884 SELECTS:80 ROWS_UPDATED:0 ROWS_FETCHED:442135 BUSY_TIME:668 ONNECTED_TIME:673 BYTES_SENT:27099136 BYTES_RECEIVED:17676 WAIT_TIME:62
Top table row reads:
DB_USER: ********** -- TOTAL_CONNECTIONS: 4 -- CONNECTED_TIME: 673 -- CPU_TIME: 606 -- TABLE_ROW_READS: 357770884 -- SELECT_COMMANDS: 80 -- UPDATE_COMMANDS: -- BUSY_TIME: 668 -- BYTES_SENT: 27099136 -- BYTES_RECEIVED: 17676 -- WAIT_TIME (IO): 62
Top WAIT (IO) TIME:
DB_USER: ********** -- TOTAL_CONNECTIONS: 4 -- CONNECTED_TIME: 673 -- CPU_TIME: 606 -- TABLE_ROW_READS: 357770884 -- SELECT_COMMANDS: 80 -- UPDATE_COMMANDS: -- BUSY_TIME: 668 -- BYTES_SENT: 27099136 -- BYTES_RECEIVED: 17676 -- WAIT_TIME (IO): 62
SN 03:31 0:01 /index.php
SN 03:32 0:02 /index.php
SN 03:34 0:01 /index.php
SN 03:35 0:00 /index.php
Fri Feb 23 03:35:58 CST 2018
Running Processes:
S 03:08 0:00 dovecot/imap
SN 03:31 0:01 /index.php
SN 03:32 0:02 /index.php
SN 03:34 0:01 /index.php
SN 03:35 0:00 /index.php
Running Queries:
*************************** 1. row ***************************
USER: *********
DB: *********
STATE: Sending data
TIME: 34
COMMAND: Query
INFO: SELECT c.`name`, cl.`id_lang`, IF(cl.`id_lang` IS NULL, c.`value`, cl.`value`) AS value, c.id_shop_group, c.id_shop
FROM `ps_configuration` c
LEFT JOIN `ps_configuration_lang` cl ON (c.id_configuration = cl.id_configuration)
*************************** 2. row ***************************
USER: **********
DB: ***********
STATE: Copying to tmp table
TIME: 10
COMMAND: Query
INFO: SELECT h.id_hook, h.name as h_name, title, description, h.position, live_edit, hm.position as hm_position, m.id_module, m.name, active
FROM `ps_hook` h
INNER JOIN `ps_hook_module` hm ON (h.id_hook = hm.id_hook AND hm.id_shop = 1)
INNER JOIN `ps_module` as m ON (m.id_module = hm.id_module)
ORDER BY hm.position
*************************** 3. row ***************************
USER: **********
DB: **********
STATE: Copying to tmp table
TIME: 102
COMMAND: Query
INFO: SELECT h.id_hook, h.name as h_name, title, description, h.position, live_edit, hm.position as hm_position, m.id_module, m.name, active
FROM `ps_hook` h
INNER JOIN `ps_hook_module` hm ON (h.id_hook = hm.id_hook AND hm.id_shop = 1)
INNER JOIN `ps_module` as m ON (m.id_module = hm.id_module)
ORDER BY hm.position
*************************** 4. row ***************************
USER: **********
DB: **********
STATE: Copying to tmp table
TIME: 178
COMMAND: Query
INFO: SELECT h.id_hook, h.name as h_name, title, description, h.position, live_edit, hm.position as hm_position, m.id_module, m.name, active
FROM `ps_hook` h
INNER JOIN `ps_hook_module` hm ON (h.id_hook = hm.id_hook AND hm.id_shop = 1)
INNER JOIN `ps_module` as m ON (m.id_module = hm.id_module)
ORDER BY hm.position
Open connections
Current Site Requests:
index.php?id_category=20&controller=category&id_la
index.php?id_product=212&controller=product&id_lan
index.php?id_product=212&controller=product&id_lan
index.php?id_product=247&controller=product&id_lan
index.php?id_product=88&controller=product&id_lang
The table structures are
Did you try profiling ? There is a great tool inside Prestashop that you can activate by modifying config/defines.inc.php :
define('_PS_DEBUG_PROFILING_', true);
I also would suggest that you take a look at PHP Versions, as it seems like their would be some major change in how scripts are handled for example between 5.2 and 7.1 versions.

How HTML works in awk command in shell scripting?

I have a script called "main.ksh" which returns "output.txt" file and I am sending that file via mail (list contains 50+ records, I just give 3 records for example).
mail output I am getting is: (10 cols)
DATE FEED FILE_NAME JOB_NAME SCHEDULED TIME SIZE COUNT STATUS
Dec 17 INVEST iai guxmow080 TUE-SAT 02:03 0.4248 4031 On_Time
Dec 17 SECURITIES amltxn gdcpl3392 TUE-SAT 02:03 0.0015 9 Delayed
Dec 17 CONNECTED amlbene gdcpl3392 TUE-SAT 02:03 0.0001 1 No_Records
output with perfect coloring: (6 cols only)
DATE FEED FILE_NAME JOB_NAME SCHEDULED TIME SIZE COUNT STATUS
Dec 17 INVEST iai guxmow080 On_Time(green color)
Dec 17 SECURITIES amltxn gdcpl3392 Delayed(red color)
Dec 17 CONNECTED amlbene gdcpl3392 No_Records(yellow color)
I am implementing coloring for Delayed, On_Time and No_Records field and I wrote below script which gives me bottom output.
awk 'BEGIN {
print "<html>" \
"<body bgcolor=\"#333\" text=\"#f3f3f3\">" \
"<pre>"
}
NR == 1 { print $0 }
NR > 1 {
if ($NF == "Delayed") color="red"
else if ($NF == "On_time") color="green"
else if ($NF == "No_records") color="yellow"
else color="#003abc"
Dummy=$0
sub("[^ ]+$","",Dummy)
print Dummy "<span style=\"color:" color (bold ? ";font-weight:bold" : "")(size ? ";font-size:size" : "") (italic ? ";font-style:italic" : "") "\">" $NF "</span>"
}
END {
print "</pre>" \
"</body>" \
"</html>"
}
' output.txt > output.html
There are 4 columns are skipped automatically.
| date | feed_names | file_names | job_names | scheduled_time| timestamp| size| count| status |
Dec 19 ISS_BENEFICIAL_OWNERS_FEED amlcpbo_iss_20161219.txt gdcpl3392_uxmow080_ori_isz_dat WEEK_DAYS 00:03 9.3734 34758 On_Time
Dec 19 ISS_INVESTORS_FEED amlinvest_iss_20161219.txt gdcpl3392_uxmow080_ori_isz_dat WEEK_DAYS 00:01 0.0283 82 On_Time
Dec 19 ISS_TRANSACTIONS_FEED amltran_iss_1_20161219.txt gdcpl3392_uxmow080_ori_isz_dat WEEK_DAYS 00:12 14.022 36532 DELAYED
Dec 19 ISS_TRANSACTIONS_FEED amltran_iss_5_20161219.txt gdcpl3392_uxmow080_ori_isz_dat WEEK_DAYS 00:23 0.0010 3 DELAYED
Dec 19 IBS_CUSTOMER_FEED ibscust_aml_***_20161219.txt gdcpl3392_uxmow080_ori_sfp_ibc WEEK_DAYS (11 _out_of_11) -NA- ARRIVED
Dec 19 IBS_DDA_NOSTRO_ACCOUNT_FEED ibsacct_aml_***_20161219.txt gdcpl3392_uxmow080_ori_sfp_ibc WEEK_DAYS (44 _out_of_44) -NA- ARRIVED
Dec 19 GP__TRANSACTIONS_FEED amltrans__20161219.txt gdcpl3392_uxmow080_ori_sfp_glo WEEK_DAYS (3 _out_of_30) -NA- ARRIVED
But when I am trying to print in a sequential order by using below command
awk '{printf("%-5s%s\t%-33s%-35s%-39s%s\t%s%-3s\t%s\t%s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10)}' output.txt, I am getting the output in a sequential format
but 4 cols are skipped. Kindly suggest!!!
| date | feed_names | file_names | job_names | scheduled_time| timestamp| size| count| status |
Dec 19 ISS_BENEFICIAL_OWNERS_FEED amlcpbo_iss_20161219.txt gdcpl3392_uxmow080_ori_isz_dat On_Time
Dec 19 ISS_INVESTORS_FEED amlinvest_iss_20161219.txt gdcpl3392_uxmow080_ori_isz_dat On_Time
Dec 19 ISS_TRANSACTIONS_FEED amltran_iss_1_20161219.txt gdcpl3392_uxmow080_ori_isz_dat DELAYED
Dec 19 ISS_TRANSACTIONS_FEED amltran_iss_5_20161219.txt gdcpl3392_uxmow080_ori_isz_dat DELAYED
Dec 19 IBS_CUSTOMER_FEED ibscust_aml_***_20161219.txt gdcpl3392_uxmow080_ori_sfp_ibc ARRIVED
Dec 19 IBS_DDA_NOSTRO_ACCOUNT_FEED ibsacct_aml_***_20161219.txt gdcpl3392_uxmow080_ori_sfp_ibc ARRIVED
Dec 19 GP__TRANSACTIONS_FEED amltrans__20161219.txt gdcpl3392_uxmow080_ori_sfp_glo YET_TO_RECEIVE

Haskell: count an enum (Days of week) by an int

I want to create a function for a calender programm, that does the following:
proceed :: Day -> Int -> Day
> proceed Mon 9
Wed
The function proceed should tell me, what weekday it is in 9 days, if today is Monday.
Now I try this:
data Day = Mon | Tue | Wed | Thu | Fri | Sat | Sun deriving Show
next :: Day -> Day
next Mon = Tue
next Tue = Wed
next Wed = Thu
next Thu = Fri
next Fri = Sat
next Sat = Sun
next Sun = Mon
proceed :: Day -> Int -> Day
proceed d a = if a==0 then next d
else proceed (next d) (a-1)
I try :
proceed Mon 9
Thu
But that's wrong, the right answear is Wed!!!!!!!
I don't know where I've made the mistake.
Thanks to bheklilr
if a == 0 then d else proceed (next d) (a-1)
It was only an off by one error!