Влади's Blog

  • публикации
    4
  • коментара
    0
  • преглеждания
    17694

Относно този блог

Публикации в този блог

Влади

OS X Server update breaks PostgreSQL

 

The OS X Server 3.2.1 just released appears to break PostgreSQL during the update process. The new version of Postgresql installed (9.3.x over 9.2.x) contains an updated configuration field: “unix_socket_directory” becomes “unix_socket_directories”, the value doesn’t change, just the name.

The installer also appears to fail while upgrading the PostgreSQL data, causing the process to crash.

Thanks to the helpful users on the Apple Discussion boards here a fix has been found. As always, back up before you change anything!

To resolve the issue first stop the postgres service (2 commands) :

sudo su
serveradmin stop postgres 

Update the configuration field (1 command) :

pico /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist
replace unix_socket_directory with unix_socket_directories
save & exit

Move the PostgreSQL data folder (1 command) :

mv /Library/Server/PostgreSQL/Data /Library/Server/PostgreSQL/DataOld

Recreate the standard PostgreSQL Data folder and initialise a blank database (1 command) :

sudo -u _postgres /Applications/Server.app/Contents/ServerRoot/usr/bin/initdb /Library/Server/PostgreSQL/Data -E utf8 --lc-collate=C --lc-ctype=C

Update the data in the blank database with data from the DataOld folder (1 command) :

sudo -u _postgres /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_upgrade -b /Applications/Server.app/Contents/ServerRoot/usr/libexec/postgresql9.2 -B /Applications/Server.app/Contents/ServerRoot/usr/bin -d /Library/Server/PostgreSQL/DataOld -D /Library/Server/PostgreSQL/Data

Restart the PostgreSQL service (2 commands) :

launchctl load -w /Applications/Server.app/Contents/ServerRoot/System/Library/LaunchDaemons/org.postgresql.postgres.plist
serveradmin start postgres

Source: Here

Влади

Ако виждате съобщението по горе при опит за активиране на Windows 7, или ви е паднала активацията на WIndows-а

Стартирате cmd като администратор и изпълнявате

sfc /scannow

Рестартирате.

Ако изпълнявате тази стъпка след паднала активация, най-вероятно ще имате съобщени "Status: Notification" след изпълнение на стъпката по горе.

Решението

Влади

Open the start menu.

Type in cmd.

Right-click on the option cmd, and choose “Run as administrator”.

If prompted, click on Yes or Continue to continue.

In the black window that opens, type slmgr -rearm exactly as shown here.

Press Enter on your keyboard.

A message will appear saying Command completed successfully. Restart your system. Restart your computer.

Влади

Bash Script for backup


#!/bin/bash
####################################
#
# Backup to NFS mount script with
# grandfather-father-son rotation
# of specified directory
#
####################################
# What to backup.
backup_files="/etc /root"
# Where to backup to.
dest="/backup/system"
# Setup variables for the archive filename.
day=$(date +%A)
hostname=$(hostname -s)
# Find which week of the month 1-4 it is.
day_num=$(date +%d)
if (( $day_num <= 7 )); then
week_file="$hostname-week1.tgz"
elif (( $day_num > 7 && $day_num <= 14 )); then
week_file="$hostname-week2.tgz"
elif (( $day_num > 14 && $day_num <= 21 )); then
week_file="$hostname-week3.tgz"
elif (( $day_num > 21 && $day_num < 32 )); then
week_file="$hostname-week4.tgz"
fi
# Find if the Month is odd or even.
month_num=$(date +%m)
month=$(expr $month_num % 2)
if [ $month -eq 0 ]; then
month_file="$hostname-month2.tgz"
else
month_file="$hostname-month1.tgz"
fi
# Create archive filename.
if [ $day_num == 1 ]; then
archive_file=$month_file
elif [ $day != "Saturday" ]; then
archive_file="$hostname-$day.tgz"
else
archive_file=$week_file
fi
# Print start status message.
echo "Backing up $backup_files to $dest/$archive_file"
date
echo
# Backup the files using tar.
tar czf $dest/$archive_file $backup_files
# Print end status message.
echo
echo "Backup finished"
date
# Long listing of files in $dest to check file sizes.
ls -lh $dest/
[/CODE]