This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEST=/root/BACKUPS | |
# Code to actually create backup files goes here... | |
# Check if we need to rotate the backup files. | |
FC=`ls ${DEST}/*.tar | wc -l` | |
if [[ $FC -gt 6 ]]; then | |
echo "Too many backup files. Deleting oldest one..." | |
DELETE_FILE=`ls -tr ${DEST}/*.tar | head -1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# info from http://geekswithblogs.net/willemf/archive/2005/10/30/58561.aspx | |
def _id_check(self, cr, uid, ids, context=None): | |
obj = self.browse(cr, uid, ids[0], context=context) | |
if obj and obj.idnumber: | |
idnum = str(obj.idnumber) | |
if len(idnum) != 13: | |
return False | |
checksum1 = 0 | |
checksum2 = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script is for updating the auto_increment field by an offset. The logic applied is | |
max(AUTO_INCREMENT) + current value in the table. | |
*/ | |
SET @db:='id_new'; | |
select @max_id:=max(AUTO_INCREMENT) from information_schema.tables; | |
select concat('update ',table_name,' set ', column_name,' = ',column_name,'+',@max_id,' ; ') from information_schema.columns where table_schema=@db and column_name like '%id' into outfile 'update_ids.sql'; |
NewerOlder