........Continuing to bash script yesterday..
I got a problem where it doesn't work when it is running using the crontab.
Here is some tips:
1. You can troubleshoot by keep the log of your cron
eg: 10 02 * * * /home/aminah/script.sh >> /home/aminah/cronscripts.log 2>&1
So, you can tail the cronscripts.log once it is running.
2. Path of you script.
Make sure you put the full path so that the script will understand where you put the script.
3. If your script is download the files, it will download it at home of your running bash file.
eg: run as root.. the download file will located at /root/
It is really good experience for me... Thanks to Allah swt....
Friday, November 27, 2015
Wednesday, November 25, 2015
Playing with bash file
This is my first command of bash file.. Usually i'm only adding few command which is already there (who already wrote by my SIFU)..
What I'm going to do is.. transfering file from sftp server A to server B and send to S3 amazon. The tricky is sftp part.. :) .. I'm creating 2 file here sftpcommand.txt and script.sh
sftpcommand.txt
+++++++++++++++++++
mget data-2015_11_24*
bye
What I'm going to do is.. transfering file from sftp server A to server B and send to S3 amazon. The tricky is sftp part.. :) .. I'm creating 2 file here sftpcommand.txt and script.sh
sftpcommand.txt
+++++++++++++++++++
mget data-2015_11_24*
bye
+++++++++++++++++++
script.sh
++++++++
#!/bin/bash
now="$(date)"
printf "Current date and time %s\n" "$now" #date of the day
now="$(date +'%Y_%m_%d')"
printf "Current date in yyyy_mm_dd format %s\n" "$now"
#.......
echo "try command"
#echo "data-$(date -d "3 day ago" +'%Y_%m_%d')"
now="data-$(date -d "1 day ago" +'%Y_%m_%d')*" #1day before current date with wildcard*
echo "startfilename=""$now" #show the output of $now
echo "changing sftp command"
sed -i "1s/.*/mget $now/" sftpcommand.txt #changing sftpcommand.txt at 1st line same value with $now
echo "sftp is running"
sftp -b sftpcommand.txt -v -P 9878 -i cthroot.pem root@sftp.server.com: #sftp bash command of sftpcommand.txt
echo "list"
find /home/aminah/data/ -name "$now" -print #work
echo "send to s3"
find /home/aminah/data/ -name "$now" -exec aws s3 cp '{}' s3://pathbucket/folder/ \; #work #sending the same value to s3..
echo "end"
+++++++
To check the command run bash #bash -x script.sh ; it will show the output and easy to troubleshoot.
And its working like charm.. horey...
Wednesday, July 1, 2015
Exchange 2010: Unable to open Exchange Management Console - Initialization Failed
Problem: (Error once to open EMC) The attempt to connect to http://exchange.contoso.com'/powershell using 'Kerberos' authentication failed: Connecting to the remote server failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: The network path was not found.
Resolutions:
Method 1:
Close all MMC/EMC instances before proceeding.
Open Registry Editor (regedit) as the user you run the EMC under.
Go to
HKEY_CURRENT_USER\SOFTWARE\Microsoft\ExchangeServer\v14\AdminTools
Look for value NodeStructureSetting.
If it is there, back it up and then remove it.
Method 2:
Close all MMC/EMC Instances before proceeding.
Open Powershell or Powershell IDE as the user you run the EMC under and execute the following command:.
Remove-ItemProperty -Path HKCU:\Software\Microsoft\ExchangeServer\v14\AdminTools\ -Name NodeStructureSettings
Close Powershell
After performing either of the methods above to remove the registry entry you should be able to open the Exchange Management Console and it will discover another Exchange server and connect.
Resolutions:
Method 1:
Close all MMC/EMC instances before proceeding.
Open Registry Editor (regedit) as the user you run the EMC under.
Go to
HKEY_CURRENT_USER\SOFTWARE\Microsoft\ExchangeServer\v14\AdminTools
Look for value NodeStructureSetting.
If it is there, back it up and then remove it.
Method 2:
Close all MMC/EMC Instances before proceeding.
Open Powershell or Powershell IDE as the user you run the EMC under and execute the following command:.
Remove-ItemProperty -Path HKCU:\Software\Microsoft\ExchangeServer\v14\AdminTools\ -Name NodeStructureSettings
Close Powershell
After performing either of the methods above to remove the registry entry you should be able to open the Exchange Management Console and it will discover another Exchange server and connect.
Monday, April 13, 2015
Hardisk full - enter full pathname of shell or return for /bin/sh; ERROR
First thing you can do is, run Fsck manually
#Fsck -y
then reboot.
Sometimes, we only fsck to that directory only
#fsck -y /dev/da01
# reboot
Sometimes, we only fsck to that directory only
#fsck -y /dev/da01
# reboot
Sunday, February 22, 2015
Server 2008R2 Standard giving "This copy of windows is not genuine" error, cannot run windows activation
I was wonder why my old server giving error to windows is not genuine... Some how this old server was activate with licence.
Here is the problem:
There is few services which is not started:
• Software Protection
• SPP Notification Service
Here is the problem:
There is few services which is not started:
• Software Protection
• SPP Notification Service
Wednesday, February 11, 2015
Clean Microsoft WSUS Content Folder
1) Correct any settings above or disapprove any approved updates.
2) Close any open WSUS consoles.
3) Go to Administrative Tools – Services and STOP the Update Services service.
4) In Windows Explorer browse to the WSUSContent folder (typically D:\WSUS\WSUSContent or C:\WSUS\WSUSContent)
5) Delete ALL the files and folders in the WSUSContent folder.
6) Go to Administrative Tools – Services and START the Update Services service.
7) Open a command prompt and navigate to the folder: C:\Program Files\Update Services\Tools.
8) Run the command WSUSUtil.exe RESET
Refference: http://blogs.technet.com/b/gborger/archive/2009/02/27/what-to-do-when-your-wsuscontent-folder-grows-too-large.aspx
Wednesday, January 28, 2015
Very Bery Busy
It takes along time not updating new post. Its doesn't mean that I am not gaining any new technology/knowledge but to much work but less resource cause me have no time to update and share the information to all readers.
Here are the list of info that I should update to my blog;
1. Amazon hardisk static and magnetic
2. How to install SCCM which I already done last year.. but still have no time to share.
3. Attending SCCM training at infotech
4. Direct Access to allow end user to auto receive changes of their password from the their domain laptop outside from office. (Done and work with charm)
5. Backup PC installation
6. Voip Technology -Setup for new building
Currently... MSSQL cluster.. still study on it... but not sure will finish since I need to migrate few apps in win 2003 which already end of life this April 2015.
Huuuh many thing to write.. and many task to be done as well..
Will update all of you later.
Bye..
Subscribe to:
Posts (Atom)